-
Notifications
You must be signed in to change notification settings - Fork 158
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get all edges on a given node #260
Comments
I'm not sure about the official approach of Pydot to this, but these sorts of things were my reason to using NetworkX, which seems to be highly compatible with Pydot. So in essence: analysis with NetworkX, dotfile and Graphviz operations with Pydot. In my humble opinion it's fine for Pydot to remain "just" an interface to Graphviz. |
In the Python interpreter, running Using the official documentation as an example: import pydot
dot_string = """graph my_graph {
bgcolor="yellow";
a [label="Foo"];
b [shape=circle];
a -- b -- c [color=blue];
}"""
graphs = pydot.graph_from_dot_data(dot_string)
graph = graphs[0]
print(graph.get_edges()) # prints list of Edge objects |
sahansk2, thank you for the suggestion, but no. That gets all edges on the graph. I want to be able to ask for just the edges on a given node. Of course I can extract that from all the edges, but it would be nice if pydot had a more straight-forward way to do it. |
Oh, sorry for misreading your question. Then, I haven't seen anything in pydot to directly support this functionality, which is a real shame. |
I'm trying to walk a dot graph I read in, and I can't find any way to ask for a list of all edges (or all in edges, or out edges) on a given node. If I know there is an edge from A->B, I can: graph.get_edge("A", "B"). But there doesn't seem to be anyway to ask for "All out edges on A." I tried a variety of things like this, but just got an empty list: graph.get_edge("A")
Right now I've just made my own data structures to work around this, but it seems like an odd oversight to me. Maybe I'm missing something?
The text was updated successfully, but these errors were encountered: