I'm becoming familiar with networkX.
I have this script to make a network:
import networkx as nx
import matplotlib.pyplot as plt
G = nx.Graph()
G.add_edge(1, 2)
G.add_edge(1, 3)
G.add_edge(1, 5)
G.add_edge(2, 3)
G.add_edge(3, 4)
G.add_edge(4, 5)
# explicitly set positions
pos = {1: (0, 0), 2: (-1, 0.3), 3: (2, 0.17), 4: (4, 0.255), 5: (5, 0.03)}
options = {
"font_size": 36,
"node_size": 3000,
"node_color": "white",
"edgecolors": "black",
"linewidths": 5,
"width": 5,
}
nx.draw_networkx(G, pos, **options)
# Set margins for the axes so that nodes aren't clipped
ax = plt.gca()
ax.margins(0.20)
plt.axis("off")
plt.show()
This code generates a basic network.
I'm wondering can anyone show me how to edit this code so I can add a hyperlink to the nodes, so that when I click on a node, it'll bring me to a webpage with more information about this node?
(Right now I'm just trying to understand if this is possible with a toy network, so any URL can be added to each node in this example, each node should have a unique URL).