-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Description
Hello, I have a very complicated diagram - 80 Nodes with around 20 clusters and 250 edges. This is a network diagram, device to device from internet to firewall to switch to AP.
The issue I'm facing
The issue I'm facing is that some nodes have a large number of edges, and even using the headport and tailport forced to east and west, the edges still come out of the top or bottom of the node and therefore the labels overlap.
Look at this stack of 4 switches for example.
On some nodes the force works and the label correctly comes out of the left/right of the node to avoid label overlaps, however I have to force labelangle="0" to get them to line up correctly, which then throws out the x coordinates and overlaps the node. For example here:
Here is a more zoomed out image showing 2 hosts and 3 switches with the associated edges:
What I've tried
- I've tried various suggestions from the advanced edges issue - flow chart support #593
- The Graphviz Edges docs (https://graphviz.org/docs/edges/)
- Different variations of layout and splines as graph attributes, however I've not found anything which gets as close to the current - certainly curved doesn't work for what a network diagram is trying to achieve.
- Adding a minlen="x" to create space in the diagram but the layout doesn't really change.
- Headport / tailport forcing such as tailport="w", headport="e"
- Using label="x" and xlabel="x" which somewhat works to avoid overlapping but because some edges span 2x A4 pages of length, tracing an edge from one device to another and then finding the correct label in the middle is tricky. Especially because there are so many tightly packed edges as you can see. A network diagram typically has the device's port information right next to it on the edge so that you can trace from one end to the other easily.
- With labelangle="0" as I have here I can use labeldistance="10" to force it out a certain amount and this works east/west but is awful north/south where the label shoots off way too far from the node. (Forget that I'm trying to avoid this entirely).
I've gone through the documentation (which is severely lacking - missing almost all customisation options entirely and having the bare minimum of examples), and through this issues list, as well as the GraphViz documentation. It looks like I have two options to achieve what I want
- Either use interim nodes instead of labels, so I would have in pseudo-code: Node(x) - Edge(a) - Node(label for node x) - Edge(b) - Node(label for node y) - Edge(c) - Node(y)
- Or potentially use the Graphviz method with edges and have my labels instead in an HTML table on the node label and link the edges to the relevant part of the table, as seen in this example: https://forum.graphviz.org/t/too-complex-diagram/1878
The question
I've spent probably 12-15 hours on this so far. Am I missing something obvious here? Is there a simple way to achieve what I want that I've missed?
I can make the Graphviz HTML option work I think - I've tried to implement it as per their website but I've not been able to work out how to do this within the context of Diagrams or find any examples on here / documentation etc.
Alternatively is the interim node-instead-of-label option my only option?
The key here is that the data for the network diagrams is 100% generated from API calls / SSH output / HTTPS scraping. This is then parsed through to create a dictionary with devices, edges etc that forms the diagram. I cannot hard code much, if anything here - unless it can be logically applied for any data input.
I have about 150 diagrams that I want to add to this method which will update every week or so. This is why the non-static data -> diagram + supporting port maps etc comes in.
I'm happy to add any further information / diagram screenshots etc that may help. I can probably get together a minimum version of my code with perhaps 6 nodes and a few edges, but I thought I'd ask first if there's a simple solution.
Thank you