Using a Digraph created using GraphViz, how can I find the shortest path between lets say 'A' and 'H' ? I know the Dijkstra algorithm and I know that GraphViz offers a tools that allows to use it, but I'm not sure that it is present in the python library.
I d'like to change also the foreground color of the nodes and edges that are part of that shortest path. (.. in blue :p )
from graphviz import Digraph
f = Digraph('Test', filename='fsm.gv')
f.body.extend(['rankdir=LR', 'size="8,5"'])
f.edge('A', 'C')
f.edge('A', 'B')
f.edge('B', 'D')
f.edge('C', 'F')
f.edge('C', 'E')
f.edge('C', 'I')
f.edge('E', 'G')
f.edge('F', 'E')
f.edge('G', 'H')
f.edge('G', 'E')
f.edge('H', 'F')
f.edge('H', 'E')
f.view()
GraphViz is a graph visualization tool. Internally it may have multiple algorithms but those may not be accessible from the wrapper because are intended for internal use. If you need to perform other operations on your graph I'd recommend Networkx, which offers several graph algorithms including shortest_paths and can then output to dot for visualization.