Search notes:

Python library: NetworkX

NetworkX is a Python package for the creation, manipulation, and study of the structure, dynamics, and functions of complex networks.
pip install networkx
import networkx as nx

G = nx.Graph()

G.add_edge('A', 'B', weight=4)
G.add_edge('B', 'D', weight=2)
G.add_edge('A', 'C', weight=3)
G.add_edge('C', 'D', weight=4)

print(nx.shortest_path(G, "A", "D", weight="weight")) # -> ['A', 'B', 'D']

See also

CDLib
Graphviz

Index