FindPath
FindPath[g,s,t]
finds a path between vertex s and vertex t in the graph g.
FindPath[g,s,t,k]
finds a path of length at most k between vertex s and vertex t in the graph g.
FindPath[g,s,t,{k}]
finds a path of length exactly k.
FindPath[g,s,t,{kmin,kmax}]
finds a path of length between kmin and kmax.
FindPath[g,s,t,kspec,n]
finds at most n paths.
FindPath[{vw,…},…]
uses rules vw to specify the graph g.
Details
- FindPath returns a list of paths from s to t. Each path is given as a list of vertices.
- FindPath[g,s,t,kspec,All] finds all the paths.
- For weighted graphs, FindPath[g,s,t,k] gives all paths with total weights at most k.
- FindPath works with undirected graphs, directed graphs, weighted graphs, multigraphs, and mixed graphs.
Examples
open allclose allBasic Examples (2)
Scope (12)
Specification (7)
Enumeration (5)
A path of length between 5 and 7:
Find all paths between two individual vertices:
FindPath gives an empty list if there is no path:
Applications (2)
Properties & Relations (2)
Text
Wolfram Research (2014), FindPath, Wolfram Language function, https://reference.wolfram.com/language/ref/FindPath.html (updated 2015).
CMS
Wolfram Language. 2014. "FindPath." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2015. https://reference.wolfram.com/language/ref/FindPath.html.
APA
Wolfram Language. (2014). FindPath. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/FindPath.html