djhenderson / python-graph

Automatically exported from code.google.com/p/python-graph
Other
0 stars 0 forks source link

dot.read() ignores default node and edge attributes #84

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Dot files may contain default attributes for nodes and edges. pydot reads them 
into the attributes of special 'node' and 'edge' nodes but dot.read() ignores 
them.

Attached is a patch. pygraph doesn't seem to have a notion of default 
attributes so the patch copies the default attributes into each node or edge of 
the graph.

pydot has get_node_default() and get_edge_default() methods but they are buggy 
so I just read the special nodes directly.

Original issue reported on code.google.com by kent3...@gmail.com on 7 Oct 2010 at 4:26

Attachments:

GoogleCodeExporter commented 9 years ago
Correction - dot.read() preserves the 'node' and 'edge' attributes but they are 
not treated specially. I haven't tested 'edge' but the 'node' node is not 
output first so it doesn't work correctly; it only sets the default properties 
for nodes occurring after the 'node' node in the output list.

Original comment by kent3...@gmail.com on 11 Oct 2010 at 3:13

GoogleCodeExporter commented 9 years ago
Sorry, I've been terribly busy in the last few months. I'm accepting this 
issue. Would you have a few test cases so I can reproduce the problem. I would 
also like to add them to our unit tests.

Original comment by pmatiello on 23 Dec 2010 at 1:49

GoogleCodeExporter commented 9 years ago
I have attached a test file that uses a default node declaration and a small 
program that just reads and re-writes the file. The new file is not correct 
because the default node should precede the other node definitions.

I don't have a sample that uses a default edge.

Looking a bit at the docs at http://www.graphviz.org/pdf/dotguide.pdf it looks 
like the order of node and edge definitions is important. The example in 
figures 3-4 sets the default node and edge in the middle of the graph and the 
defaults affect the following definitions. So it looks like you really should 
be preserving the order of all nodes and edges.

Original comment by kent3...@gmail.com on 27 Dec 2010 at 9:16

Attachments: