Graphviz Error

Hi All,

I’m creating a graphviz plot of topic and subscriber nodes, similar to a ROS plot. At the end of my script I have st.graphviz_chart(A), where A is a graphviz object. However, when I run the file using the streamlit run command, the web app opens and displays:
original plot() function using pygraphviz and not graphviz

I’m using graphviz, not pygraphviz. Also, it literally worked yesterday, so I’m stumped. Any help would be greatly appreciated.

Also side question since I’m just starting out with streamlit, is it possible to make my graphviz plot interactive? For example, a user could move around the nodes, select various filters of information to display, can save an image of the plot, stuff like that? Thank you!

Bryan

Hi @Bryan,

Welcome to the Streamlit Community! :balloon: :tada: :partying_face: :tada: :balloon: :partying_face:

You can check out the streamlit-agraph component:

It allows you to do exactly that, do interactive charts.

Also pyvis is on the rise amongst the guys in the community:

Happy Streamlit-ing,
Chris

2 Likes

Thanks! I’ll look into that. Also, do you have any advice for the issue I’m encountering?

Bryan

Also, can streamlit-agraph use graphviz objects?

Hi Bryan, could you provide a minimal snippet for that task??
And welcome to the forum!!

1 Like

Snippet of my code?

Yeah, to understand better what you want to do, you can write it here using triple backquotes (```)

1 Like

Here’s a snippet of my code. It relies on some functions that parse a dictionary, where the dictionary contains information about nodes and their edges, but this is the code that generates the graphviz plot.

import graphviz as gv
A = gv.Graph()
topics_subscribers = edges()
pntr=0


for k in range(len(subscribers)):
    ProcID = y[list(y.keys())[k]]['procId']
    with A.subgraph(name='cluster'+str(ProcID)) as c:
        c.node(topics_subscribers[pntr][1])
        c.attr(label='Process ID ' + str(ProcID))
    pntr+=1

for j in range(len(x)):
    ProcID = x[j]['procId']
    machine = x[j]['machine']
    with A.subgraph(name='cluster'+str(ProcID)) as b:
        b.node(x[j]['topicName'])
        b.attr(label='Process ID ' + str(ProcID) + '       Machine '+ str(machine))
    
A.edges(topics_subscribers)
A.attr(overlap='false')  

A = apply_styles(A, styles)
A.render('test-output/round-table.gv', view=True)