Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Visualization
- def visualize(edges):
- from pyvis.network import Network
- # Create a network
- net = Network()
- for u, v, weight in edges:
- net.add_node(u)
- net.add_node(v)
- net.add_edge(u, v, label=str(weight), color='red')
- # print(u, v, weight)
- net.show('network.html')
- # MAIN FUNCTION
- edges = [('A', 'B', 1),
- ('B', 'C', 4),
- ('B', 'C', 2),
- ('C', 'D', 6),
- ('A', 'D', 3)]
- visualize(edges)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement