How to add same node multiple times in different parts of the graph

242 Views Asked by At

I create a graphviz graph with python automatically with python. Part of this automatically generated graphs have a repetition of the same node (actually for different purposes), so I want to show them separately. Is there some kind of configuration which may allow to do that. Manually, I can do that if I play with the dot file by adding some spaces on some node labels. I create the graph starting from definitions of the edges. I mean what I have is a list of edges, not a list of nodes. Instead of configuration, I would appreciate if you can suggest a code part that does this. Simply adding a space to all new node repetitions in the edge list does not work, cause some should not have that space.

1

There are 1 best solutions below

0
On

I decided to add white spaces to the graph right from the start. So, they are defined as different nodes. When I need a node_name to query something from some dict for example, I just trim the space. It worked quite fine.