1

When using networkx.draw() it is possible to specify different node positioning algorithms that change the graph layout using the pos keyword argument. For example:

import networkx as nx
import matplotlib.pyplot as plt

# create a graph
G = nx.dodecahedral_graph()

# draw with different layouts
plt.figure()
nx.draw(G,pos=nx.circular_layout(G))
plt.figure()
nx.draw(G,pos=nx.spring_layout(G))

gives you these two different layouts:

enter image description here enter image description here

Is it possible to do this using pyvis?

Johannes Wiesner
  • 1,006
  • 12
  • 33

1 Answers1

2

Yes, mainly there are four types:

  • BarnesHut
  • ForceAtlas2Based
  • Repulsion
  • HierachicalRepulsion

you can check their effects by setting the option show_buttons(filter_=["physics"]):

net = Network(...)
net.show_buttons(filter_=["physics"])

on the drop-down that appears (the option 'solver')

Manu
  • 36
  • 2