Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

generate_random_traffic_network intended behavior? #73

Open
forrestmckee opened this issue Jul 18, 2022 · 0 comments
Open

generate_random_traffic_network intended behavior? #73

forrestmckee opened this issue Jul 18, 2022 · 0 comments
Labels
question Further information is requested

Comments

@forrestmckee
Copy link

For generate_random_traffic_network in generate_network.py, the resulting network has less nodes than n_clients. Is this intentional?
I believe the reason is that when building up edge_labels , the datatype is a set (which makes sense). This means that duplicate edges can't exist. However, when creating the traffic graph, edge_labels is iterated over.

import cyberbattle.simulation.generate_network as gn
import networkx as nx

random_traffic = gn.generate_random_traffic_network(n_clients=10,n_servers={"A":1})
random_traffic.number_of_nodes()

yields 5 nodes for me.

If the above is not the intended behavior, should there really be the sum of the values in the n_servers dict plus n_clients?
So in my above example 10+1 nodes total representing 10 clients and 1 server.

That (10+1 from above) seems to be the behavior in the networkx example of stochastic_block_model (used to create the traffic). Although, that leaves the opportunity for nodes to not be connected to any other nodes.

import networkx as nx
sizes = [10,1]
probs = [[0.25, 0.05], [0.05, 0.35]]
g = nx.stochastic_block_model(sizes, probs, seed=0)
g.number_of_nodes()

yields 11 nodes for me

Please let me know if you need further clarification on my question.

@blumu blumu added the question Further information is requested label Oct 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants