Python Forum
PyEDA-IPython Problem [Graph]
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
PyEDA-IPython Problem [Graph]
#1
Hi,
I'm using ipython for drawing binary decision diagrams but i have a problem.

I'm trying to have a graphical model of this:

In [1]: %load_ext gvmagic

In [2]: import pyeda

In [3]: from pyeda.inter import *

In [4]: a, b, c = map(bddvar, 'abc')

In [5]: f = a & b | a & c | b & c

In [6]: %dotobj f

In [7]: f.to_dot()

Out[7]: 'graph BDD { n140390891948072 [label=0,shape=box]; n140390892027576 [label=1,shape=box]; n140390840874880 [label="c",shape=circle]; n140390840893680 [label="b",shape=circle]; n140390840906304 [label="b",shape=circle]; n140390840906248 [label="a",shape=circle]; n140390840874880 -- n140390891948072 [label=0,style=dashed]; n140390840874880 -- n140390892027576 [label=1]; n140390840893680 -- n140390891948072 [label=0,style=dashed]; n140390840893680 -- n140390840874880 [label=1]; n140390840906304 -- n140390840874880 [label=0,style=dashed]; n140390840906304 -- n140390892027576 [label=1]; n140390840906248 -- n140390840893680 [label=0,style=dashed]; n140390840906248 -- n140390840906304 [label=1]; }'
this is the example that is available in pyeda documentation, but i didn't see any way to importing this code to jpg/png files!

anyone can help me?
Apparently my graph is now made, but how do I see it? There are no instructions for that on the website
Reply
#2
what you get is representation of the graph in DOT language. It looks like there is a program GraphViz
http://graphviz.org/
that can generate visual representation of the graph from it
some reference:
https://graphs.grevian.org/
http://www.graphviz.org/pdf/dotguide.pdf
http://tonyballantyne.com/graphs.html

There are plenty more...

But if you want to keep it strictly python - there are python packages to work with
https://pypi.org/project/graphviz/
https://pypi.org/project/pydot/

here are google results
https://www.google.com/search?q=generate...and+python
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#3
Thanks for your answer,
i already install the GraphViz.
but i don't know how to see the generated graph!
Reply
#4
what you have so far is not the graph. it's not generated yet. It is just a description of the graph in DOT language. You need to use this description AND GraphViz to generate/render the graph as a file. I have provided plenty of links to resources that you can use...
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#5
(Jun-01-2018, 06:58 PM)buran Wrote: what you have so far is not the graph. it's not generated yet. It is just a description of the graph in DOT language. You need to use this description AND GraphViz to generate/render the graph as a file. I have provided plenty of links to resources that you can use...

Thanks, I will check the links and resources completely and will inform the result to help other people with the same problem Wink
Reply
#6
note also the Resources page on GraphViz site. There is section Language Bindings
http://graphviz.org/resources/
there are more python packages than I posted
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  IPython errors for numpy array min/max methods muelaner 1 506 Nov-04-2023, 09:22 PM
Last Post: snippsat
  Can a program execute code in iPython shell and get result? deanhystad 3 1,660 Jun-17-2022, 03:45 AM
Last Post: Larz60+
  IPython console vs Spyder script losc 3 2,672 Apr-30-2020, 04:57 AM
Last Post: deanhystad
  How can I create a multiline input in ipython? DataMower 3 4,307 Oct-28-2019, 08:50 PM
Last Post: DataMower
  Plot multiple csv into one graph problem with visualize linkxxx86 1 5,668 Oct-14-2019, 05:54 PM
Last Post: linkxxx86
  ipython autocomplete broke indentation! Exsul 6 4,466 Aug-20-2019, 01:29 AM
Last Post: Exsul
  Graph coloring problem jackrus1010 0 4,361 Oct-20-2018, 10:19 AM
Last Post: jackrus1010
  How to clear IPython console in Spyder? Vai 7 55,662 Aug-20-2018, 09:43 PM
Last Post: james_balcomb
  Stopwatch in Python/IPython shell suvadip 3 4,206 Jul-06-2018, 01:51 PM
Last Post: snippsat
  Spyder : Clear IPython Console whenever I re-run the script smallabc 0 5,214 Mar-04-2018, 08:05 AM
Last Post: smallabc

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020