Open thorwhalen opened 1 year ago
Note: I had problems running [the code mentioned above]. I'm told I need pygraphviz
, but when I try to pip install I get:
(...)
error: subprocess-exited-with-error
× Running setup.py install for pygraphviz did not run successfully.
│ exit code: 1
╰─> [11 lines of output]
(...)
The most voted solution of https://stackoverflow.com/questions/69970147/how-do-i-resolve-the-pygraphviz-error-on-mac-os
didn't work for me, but the second did:
https://stackoverflow.com/questions/69970147/how-do-i-resolve-the-pygraphviz-error-on-mac-os
python -m pip install \
--global-option=build_ext \
--global-option="-I$(brew --prefix graphviz)/include/" \
--global-option="-L$(brew --prefix graphviz)/lib/" \
pygraphviz
There is also: pydot It can parse and dump into the dot language and send to networkxx.
We can make a dot digraph from a
DAG
which is very useful to view it.We also have some convenient ways to make a
DAG
, such as thecode_to_dag
function.Yet I still find myself sometimes building a graph using the dot language (or rather a mini-dot language (I use
from qo import dgdisp
)). This may indicate the utility of building a DAG from a dot string.I tried to write a function that takes a
graphviz.Digraph
instance and returns the edges of the graph as pairs of node IDs, so that I could then use this to make myDAG
(using a similar approach ascode_to_dag
). But I failed. It seems like those graphviz objects are for writing, not reading -- at least not reading into some python-ready object.I then decided to go through
networkx
, which has a lot of conversion tools. This code looked promising.My slightly modified version: