-
Notifications
You must be signed in to change notification settings - Fork 278
Description
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.