Closed GoogleCodeExporter closed 9 years ago
The method: graph_from_edges() is broken. It only updates the edge_list. It
doesn't update the node_list.
If you change your code to build your own nodes and edges using
graph.add_node() and graph.add_edge() then
everything behaves properly.
Original comment by adewale
on 5 Jun 2009 at 1:53
I've attached a patch, with tests, which fixes this issue. It checks that when
building a graph using
pydot.graph_from_edges() we add the nodes into the graph if they haven't
already been added.
It might be a better idea to change the add_edge method so that it always adds
the 2 nodes if they don't already
exist. However that's a change with more side-effects and I didn't want to risk
it in my first patch to the project.
Consequently this patch only fixes one of the convenience methods for building
a graph. The other convenience
methods will all still exhibit the same bug.
Original comment by adewale
on 6 Jun 2009 at 1:59
Attachments:
If one wants Nodes to be created they should be created before the edges, edges
won't create Nodes.
I admit it's awkward but it was the only way of passing Graphviz's test-set.
Edges can exist without associated nodes. If the nodes are created whenever
edges are added the output of pydot will not agree with Graphviz's own parsing.
Original comment by ero.carr...@gmail.com
on 30 Oct 2010 at 11:51
Original issue reported on code.google.com by
stevenso...@gmail.com
on 9 May 2008 at 9:21