3
votes

I am drawing a network topology diagram (Telecoms related) from an adjacency matrix. I have a numpy adjacency matrix from which I generate a networkx graph (G).

At a particular Site (City) I have multiple nodes, that may or may not be interconnected. The site name can be determined from the Node name (label).

Is it possible to cluster the nodes at the same site together (and ideally draw a box around them), while displaying the individual nodes within the site? I consider this like grouping nodes based on some node attribute such as node name.

I the diagram Site A shows the desired output for the diagram.Example graph

I believe I could get a solution if I created dummy edges between nodes at the same site, and gave them a high weight using spring layout to ensure the same nodes at a site are close together, however this does not seem like an optimum solution.

Any advice appreciated!! Thanks in Advance. Also note it is not essential to use numpy, networkx I am open to suggestions.

1
Could you use the physical locations of the sites to do the layout? You could then group sites based on their name and use something like scipy.spatial.ConvexHull to draw a box around them. - Till Hoffmann
Please read How to Ask and minimal reproducible example and rewrite your question accordingly. - boardrider

1 Answers

0
votes

I've been dealing with a similar problem recently. My solution was to create a dummy graph, where node properties were the new nodes, and edges among the new nodes were weighted based on the number of connections between individual node types.