Man Linux: Main Page and Category List

dijkstra - single-source distance filter

dijkstra[-ap?] [sourcenodefile]

dijkstrareads a stream of graphs and for each computes the distance of every node fromsourcenode.Edge length is given in thelenattribute, and the default is 1. Thedistattribute of every node is set to its distance fromsourcenode.If the-pflag is used, theprevattribute of each node reachable fromsourcenodeis set to the name of the previous node on a shortest path. The graph attributemaxdistis set to the maximumdistof all nodes in the graph. By default, if the graph is disconnected, thedistattribute of nodes unreachable fromsourcenodeare left untouched, andmaxdistis set to the maximum of any previous value and the largest distance recorded in this run. On the other hand, if the-aflag is used, thedistattribute of an unreachable node is assigned a very large value, andmaxdistrecords the maximum distance found in the component containingsourcenode.Any number ofsourcenodefilepairs may be given. If the lastfileis missing,stdinis used. All output is written tostdout. In a typical application,distandmaxdistcan drive a downstream calculation of color or some other attribute.

gvpr(1), gvcolor(1), libgraph(3) 21 March 2001