Return node/edge reference on add?

0 views
Skip to first unread message

nernst

unread,
Jul 9, 2009, 12:37:07 PM7/9/09
to pygraphviz-discuss
I'm just starting with pygraphviz, but it looks like if I add a node:
G.add_node('hi')
the method doesn't return a reference to the new node. If I want to
manipulate it, I need to do
n = G.get_node('hi')
which I can then manipulate to alter attributes, etc. I realize this
is possible if I pass the attribute in to the args to add_node, but
this seems less readable.

Is it possible to return the reference in the add_node method?

Aric Hagberg

unread,
Jul 9, 2009, 3:47:47 PM7/9/09
to pygraphvi...@googlegroups.com
That is certainly possible. And I don't see any reason why we shouldn't.
We would probably want to do the same for add_edge() then too.

Aric

Reply all
Reply to author
Forward
0 new messages