I'm trying to plot an oriented graph with pyvis. In the documentation they suggest using the following command for creating an oriented edge:
net.add_edge(4,1,from=1,to=4)
The problems are two:
TypeError: add_edge() got multiple values for argument 'to'
Any suggestion?
You don't need to directly specify to
and from
in your add_edge
function if you had specified directed=True
when you created your network. The order of the nodes in the add_edge
function is enough to describe the direction.
Below is an example:
from pyvis.network import Network
net = Network(directed =True)
net.add_node(0, label='a')
net.add_node(1, label='b')
net.add_edge(0,1)
net.show('mygraph.html')
And the output gives: