eBay / bayesian-belief-networks

Pythonic Bayesian Belief Network Package, supporting creation of and exact inference on Bayesian Belief Networks specified as pure python functions.
Other
1.13k stars 256 forks source link

GraphViz Input #11

Closed mgroden closed 10 years ago

mgroden commented 10 years ago

How does one send the stringio generated for GraphViz input to GraphViz to get the graph image? I downloaded Graphviz but am unsure of how to pass the stringio to Graphviz. Is PyGraphViz necessary?

nnewey commented 10 years ago

Hi. If you use the export method, just supply a filename and then open it in GraphViz, you do not need PyGraphViz. For example suppose your graph is called g:

>>> g.export(filename='mygraph.gv')

Now start GraphViz, select 'file', 'open' and navigate to the file. Alternately in a GUI (e.g. Mac OS X Finder) just double click on the file and if GraphViz is setup as the program that handles the .gv extension it should open.