Macaulay2 » Documentation
Packages » CodingTheory » shortestPath
next | previous | forward | backward | up | index | toc

shortestPath -- shorthest path in a digraph

Description

Given a digraph D, a vertex start in D, and a list of vertices finishSet of D, this function returns the shortest path in D from start to finishSet.

It is safe to use this in applications that have nothing to do with coding theory.

i1 : D = digraph({x,y,z,u,v}, matrix {{0,1,0,1,0},{0,0,1,0,0},{0,0,0,1,1},{0,0,0,0,0},{0,0,0,0,0}});
i2 : shortestPath (D,x,{z,v})

o2 = {x, y, z}

o2 : List

Ways to use shortestPath:

  • shortestPath(Digraph,Thing,List)

For the programmer

The object shortestPath is a method function.


The source of this document is in CodingTheory.m2:3692:0.