Section: User Commands (1)
Updated: 21 March 2001
dijkstra - single-source distance filter for Graphviz
reads a stream of Graphviz formatted graphs and for each computes the distance of every node from
Edge length is given in the
attribute, and the default is 1. The
attribute of every node is set to its distance from
If the -p
flag is used, the
attribute of each node reachable from
is set to the name of the previous node on a shortest path.
The graph attribute
is set to the maximum
of all nodes in the graph.
If the -d flag is used, the graph is treated as directed and
only forward edges are used.
By default, if the graph is disconnected, the
attribute of nodes unreachable from
are left untouched, and
is set to the maximum of any previous value and the largest
distance recorded in this run. On the other hand, if
the -a flag is used, the
attribute of an unreachable node is assigned a very large value,
records the maximum distance found in the component containing
Any number of
pairs may be given.
If the last
is missing, stdin is used.
All output is written to stdout.
In a typical application,
can drive a downstream calculation of color or some other attribute.