# 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 less than k.
• FindPath works with undirected graphs, directed graphs, weighted graphs, multigraphs, and mixed graphs.

# Examples

open allclose all

## Basic Examples(2)

Find a path between two individual vertices in a graph:

 In[1]:=
 In[2]:=
 Out[2]=

Highlight the path:

 In[3]:=
 Out[3]=

Find all paths between two individual vertices in a graph:

 In[1]:=
 In[2]:=
 Out[2]=