Node improvement from yapgvb

2 views
Skip to first unread message

Greg

unread,
May 26, 2009, 4:00:26 PM5/26/09
to pydot
I've used yapgvb recently, but am considering switching to pydot due
to lake of functionality in yapgvb.

I really like in yapgvb how I can create nodes and edges using
something similar to this:

node1 = g.add_node(Node('node1'))
node2 = g.add_node(Node('node2'))
node1 >> node2


To acheive this functionality in pydot, it's simple:

1) Add the following method to the Node class:
def __rshift__(head, tail):
parentGraph = head.get_parent_graph()
parentGraph.add_edge(Edge(head, tail))

2) cause add_node to return the inputed node instead of returning
None. (I'd also recommend that the other add_ calls return the
inputted objects)


My apologies these changes aren't in patch form.

Greg
Reply all
Reply to author
Forward
0 new messages