microsoft / microsoft/CyberBattleSim

generate_random_traffic_network intended behavior?

Open
#73 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

question
Dominant language
Jupyter Notebook
Stars
1.8k
Forks
286
Avg merge
4h 35m
Merged PRs (30d)
12

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in cyberbattle/simulation/generate_network.py at generate_random_traffic_network and reproduce the n_clients=10, n_servers={"A":1} example. Compare the edge_labels construction with the NetworkX stochastic_block_model behavior described in the issue. Done means the intended node-count behavior is decided and documented or reflected in the implementation.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
networking
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.