Changing node ID

45 views
Skip to first unread message

Paul Irolla

unread,
Aug 16, 2013, 5:24:57 AM8/16/13
to ruby-g...@googlegroups.com
Hello,

I have nodes that share the same name but I want to draw all duplicates nodes.
I saw that I have to change the node id attribute. I tried this way in order they get an unique id :

newNode = graph.add_node(nodeName, :id => "ID_#{@nodeCounter}")

But it doesn't draw the duplicates nodes. Can you tell me what am I doing wrong ?

Thank you in advance,
Paul.

Gregoire Lejeune

unread,
Aug 16, 2013, 6:26:25 AM8/16/13
to ruby-g...@googlegroups.com, ruby-g...@googlegroups.com
hello,

i think you made a confusion between name, id and label. Try with this :

newNode = graph.add_node("ID_#{@nodeCounter}", :label => nodeName)

Instead of :

> newNode = graph.add_node(nodeName, :id => "ID_#{@nodeCounter}")

Greg

Gregoire Lejeune

unread,
Aug 16, 2013, 6:35:49 AM8/16/13
to ruby-g...@googlegroups.com
I see why you made this confusion. It is my fault. I'll rewrite de documentation of GraphViz#add_node. Indeed, the first parameter is the node ID, used as label if none is given.

Sorry for the poor documentation.

Greg

Paul Irolla

unread,
Aug 16, 2013, 6:43:03 AM8/16/13
to ruby-g...@googlegroups.com

It works now exactly how i expect it, thank you for your quick reply.
No problems for the documentation, you helped me well.

Paul.

Reply all
Reply to author
Forward
0 new messages