NetworkX
Create, analyse and visualise graphs and networks in pure Python.
Easy
import networkx as nx
G = nx.Graph(); G.add_weighted_edges_from([("A", "B", 4), ("B", "C", 1), ("A", "C", 7)])
nx.shortest_path(G, "A", "C", weight="weight") # ['A', 'B', 'C']
Spotted a mistake or want to add detail? Suggest an improvement — Content Contributors' edits are reviewed by editors before they go live.
Discussion (0)
Sign in or join free to ask questions and discuss this topic.