Paths, Cycles, and Flows

One of the key problems in graphs is navigation. In particular, the problem is finding the shortest path between two vertices, whether that is finding the way out of a maze or navigating a road network. The lengths of the shortest paths give rise to a whole collection of natural measures such as the diameter of a graph. If instead of navigating from one vertex to another you would like to traverse the whole graph in some way, you are looking for cycles. Eulerian and Hamiltonian cycles provide paths that traverse every edge or vertex of graph.

Shortest Paths

FindShortestPath find the shortest path from the source to a target

ShortestPathFunction represent a function that gives the shortest path in a graph

FindHamiltonianPath find the shortest path that traverses every vertex once


FindMaximumFlow find the maximum flow between two vertices

FindMinimumCostFlow find minimum cost flows

OptimumFlowData represent optimum flow data


GraphDistance the length of the shortest path between two vertices

GraphDistanceMatrix the matrix of graph distances between all pairs of vertices

Longest Shortest Paths

VertexEccentricity length of the longest shortest path to every other vertex

GraphRadius minimum vertex eccentricity

GraphDiameter maximum vertex eccentricity

GraphCenter vertices with minimum eccentricity

GraphPeriphery vertices with maximum eccentricity

Topological Paths

TopologicalSort gives vertices in an order compatible with graph topology

Cycles and Tours

FindShortestTour find the shortest tour that traverses every vertex once

FindPostmanTour find a tour that traverses every edge at least once

FindEulerianCycle find a cycle that traverses every edge exactly once

FindHamiltonianCycle find a cycle that traverses every vertex exactly once

FindCycle find all cycles of specified length

EdgeCycleMatrix  ▪  FindFundamentalCycles  ▪  EulerianGraphQ  ▪  HamiltonianGraphQ

Independent Paths

FindEdgeIndependentPaths find edge-independent paths between two vertices

FindVertexIndependentPaths find vertex-independent paths between two vertices

FindPath find paths between two vertices