Skip to content
Advertisement

How to draw shapes in a graph using nodes and edges in python?

I need to draw the shapes from the following photo in a graph. I need to transpose the shapes in a graph in Python with nodes and edges. img1

img2

Advertisement

Answer

One of the standard tools for defining graphs like this is the DOT language used by Graphviz.

You can create DOT graph descriptions and render them with the PyPI package graphviz, or with the pydot package.

Both appear to require that you have Graphviz installed if you want to render images.

Disclaimer: I’ve written plenty of Python and I’ve fiddled with DOT and Graphviz, but I haven’t used the above libraries.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement