Skip to content

Network topology builder tool

DISSOUBRAY Nathan requested to merge network_topology_builder into master

Description

Add a tool to more quickly build network topology, by specifying the ID of each node to connect to

This closes #2 (closed)

Usage

build_network [
     [1],
     [0, 3],
     [3],
     [1,2,4],
     [3,5,6],
     [4],
     [4],
]

Will build the following topology:

    2        5
      \     /
       3 - 4
      /     \ 
0 - 1        6

Each line of the matrix gives the nodes it connects to, line 0 says 1, meaning node 0 connects to node 1 Line 4 says [3, 5, 6] meaning node 4 connects to 3, 5, 6

Note

Dialing works both way (meaning that if 0 connects to 1, then it's the exact same as 1 connecting to 0). To prevent double dialing (which is useless), the code will ignore dial attempts to node whose number is smaller than its own node number (meaning we only dial numbers that are bigger).

This also means we can shorten the way we write the connection list by only specifying the nodes with a bigger number (and replacing the empty list by [0]). This loses a bit of readability, but for bigger networks it might make writing the topology way shorter

Merge request reports