The Graphviz site will soon be moved to a new host, and have a different format. You can try out the new site here. If you have suggestions or encounter any problems, please send mail to [email protected] |

# Equal nodes?

Submitted by demaseme on Wed, 10/09/2013 - 20:01

Is there a way to tell dot that a node and another one are the same, even if they have different labels?

I have these nodes (which are names of sets)

(q0 q2 q1)

(q0 q1 q2)

Also, I have these two:

(q2 q1) (q1 q2)

So, in set theory, they're equivalent.

But Dot doesn't know that, so instead, it creates 2 different nodes. I could make the combinations of items in the sets, and then put them there but Dot draws them even if there's no edge that leads to them.

Is there a way to:

1.- Tell Dot that a=b where a and b are different node tags?

2.- Tell Dot not to draw a node a if no edge leads to them? Thanks in advice! :)

Attachment | Size |
---|---|

ceps-afd.png | 35.52 KB |

## Recent comments

- This is a bug that has been

16 weeks 6 days ago - Double edges: even with latest version

16 weeks 6 days ago - If you run dot.exe -V, this

26 weeks 3 days ago - Not sure

26 weeks 3 days ago - What version of Graphviz are

26 weeks 4 days ago - update

1 year 21 hours ago - re: yum install - Error downloading packages

1 year 8 weeks ago - yum install - Error downloading packages

1 year 8 weeks ago - Hi,
Sorry, I was a little

1 year 9 weeks ago - The difficulties you are

1 year 13 weeks ago

## In Graphviz graphs, the node

In Graphviz graphs, the node name is its key. That is, if two nodes have the same name, they are the same node; if they have different names, they are different nodes. So any equivalence relation you want needs to be supported by you. In particular, dot has no model of set theory built in. So the answer to question 1 is no. Node tags (names) determine equality.

For the second question, the layout programs draw the graph given as input, so if there is something you don't want drawn, this has to be supplied as part of the input, either when creating the graph or by preprocessing. An easy way to do this is to use gvpr. For example, the command pipeline

gvpr -c 'N[$.degree==0]{$.style="invis"}' yourgraph.gv | dot -Tpng > yourgraph.png

will make all nodes without edges invisible in the drawing. They will take up space, so you may want to use {delete($G,$)} instead as the action.