0

I'm trying to visualize a network in Pyvis. My nodes belong to two groups, and I would like to "separate them", showing one group on one side and one group on the other, like in the following "across-the-isle" visualization:

"Across-the-isle visualization"

Does anybody know how to do it, or whether other network visualization packages can do it? I am quite agnostic in this respect (I would simply avoid networkx as it is based on matplotlib, hence graphs do not look great)

I looked into Pyvis' documentation, but no help there.

An example might be the following:

import pyvis

# Create a Pyvis network object
net = Network(height="1000px", width="1000px")

# Add nodes to the network with group assignments
net.add_node("Node 1", group=1)
net.add_node("Node 2", group=2)
net.add_node("Node 3", group=1)
net.add_node("Node 4", group=2)
net.add_node("Node 5", group=1)

# Add edges to the network
net.add_edge("Node 1", "Node 2")
net.add_edge("Node 2", "Node 3")
net.add_edge("Node 3", "Node 4")
net.add_edge("Node 4", "Node 5")
net.add_edge("Node 5", "Node 1")

# Display the network
net.show("across_the_isle.html")

pyvis network

Here, I would simply like to have yellow nodes on the left side of the graph, and blue nodes on the right side.

Thanks!

0 Answers0