pydot / pydot-ng

Python interface to Graphviz's Dot language compatible with Python 2 nad Python 3
MIT License
23 stars 10 forks source link

[70] Nodes not identified in graph #11

Open prmtl opened 9 years ago

prmtl commented 9 years ago

Reported by olliegla...@gmail.com, 2012-04-09T20:11:41Z

What steps will reproduce the problem?

1) Create this dot file:

graph condiments {
    ketchup -- mayonnaise -- tartar -- lemon
    ketchup -- bbq
}

2) Create and run this python script:

impot sys
import pydot

# first arg is the dot file
if len(sys.argv) < 2:
    exit()

g = pydot.graph_from_dot_file(sys.argv[1])

print g.get_node_list()
What is the expected output? What do you see instead?

The output is an empty list, I expected a list of nodes (ketchup, bbq, etc.)

What version of the product are you using? On what operating system?

pydot-1.0.28 with Python 2.7.1, OS X

Please provide any additional information below.

From: https://code.google.com/p/pydot/issues/detail?id=70

prmtl commented 9 years ago

Comment by carnioja...@gmail.com, 2012-04-18T21:54:55Z

+1.

If you have nodes implicitly defined, like:

a; a -> b -> c -> d; c;

Only the "explicitly" defined nodes (the ones given their own lines) will be accessible. It really shouldn't work this way.

prmtl commented 9 years ago

Comment by wod...@gmail.com, 2012-05-07T06:11:37Z

Graphviz uses implicitly defined nodes as well. It would be useful to have a lib acting the same way.