DIJKSTRA(1)

πŸ“¦
version 16.1.0 Β· 2 versions
, in alpine 3.22, alpine 3.23, alpine 3.24, arch rolling, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0

πŸ’– DIJKSTRA(1) πŸ’– β€” the single-source distance filter, bestie edition

okay so real talk: this is a page from the General Commands Manual, and the star of the show is dijkstra, a single-source distance filter for Graphviz. She's giving main character energy and she is so good at her job. Let's get into it. ✨


🌸 NAME 🌸

dijkstra β€” single-source distance filter for Graphviz πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

dijkstra [ -adp? ] [ sourcenode file ]

πŸ¦‹ DESCRIPTION πŸ¦‹

dijkstra reads a stream of Graphviz formatted graphs, and for each one she computes the distance of every single node from sourcenode. No node left behind, periodt. πŸ’–

Edge length? That lives in the len attribute, and if you don't say anything, the default is 1. Then the dist attribute of every node gets set to its distance from sourcenode. Iconic behavior, honestly.

If the -p flag is in the chat, the prev attribute of each node reachable from sourcenode gets set to the name of the previous node on a shortest path. Like, the receipts of how you got there. 🫢

And the graph attribute maxdist gets set to the maximum dist of all nodes in the graph. She's keeping score. πŸ‘‘

If the -d flag is used, the graph is treated as directed and only forward edges are used. One-way streets only, bestie. 🚦

Now here's the part where the drama lives β€” what happens when the graph is disconnected:

  • By default, the dist attribute of nodes that are unreachable from sourcenode is left untouched (no touchy πŸ™ˆ), and maxdist is set to the maximum of any previous value and the largest distance recorded in this run.
  • But if you use the -a flag, the dist attribute of an unreachable node gets assigned a very large value, and maxdist records the maximum distance found in the component containing sourcenode. So she stops ignoring the stragglers and starts pointing at them dramatically. 😭

Any number of sourcenode file pairs may be given. Yes, ANY number. Go off. πŸŽ€ If the last file is missing, stdin is used. And all output is written to stdout β€” every bit of it, no cap. πŸ’―

In a typical application, dist and maxdist can drive a downstream calculation of color or some other attribute. So she's out here setting the whole vibe for your graph's aesthetic. 🌈


πŸ‘‘ SEE ALSO πŸ‘‘

gvpr(1), gvcolor(1), libgraph(3)


okay and for the cute sign-off: this little baddie comes to you from the General Commands Manual, dated 21 March 2001 β€” yes, she's an elder icon and she ate that. πŸ’…βœ¨ πŸ¦‹

πŸ“¦ where this page comes from