I am trying to vizualize a large network with pyvis
and facing two problems:
- super long rendering
- network instability, i.e. nodes move too fast and it is hard to interact with such a network.
Disabling physics with toggle_physics(False)
helps to speed up rendering and makes the network static, but eliminates the layout settings. This is how it looks agter disabling physics:
link. As you see, the graph is messy and has no structure.
What I want to do is to disable physics but keep the layout settings, i.e. I want my graph to look like a normal network (e.g. similar to spring layout in networkX
) with weights taken into account for every edge. Is there a way to do so?
So far I found out that pyvis
only has hierarchial layouts, which is not what I need. I think integrating a networkX
layout might help but I have no idea how to do this, since networkX
allows to set layout as a keyword argument in nx.draw()
function, which is not compatible with my case. This is my code in case it helps to understand my problem:
g = nx.Graph()
edges_cards = cards_weights_df.values.tolist()
g.add_weighted_edges_from(edges_cards)
net = Network("1000px", "1800px")
net.from_nx(g)
net.toggle_physics(False)
net.show("graph.html")
Your help is appreciated!