dijkstra

shortest path graph algorithm filter

TLDR

Compute shortest path from a source node in a graph
$ dijkstra -p [source_node] [input.dot]
Output distance matrix for all pairs of nodes
$ dijkstra -d [input.dot]
Write processed graph to output file
$ dijkstra [input.dot] -o [output.dot]
Compute shortest paths and output to file
$ dijkstra -p [source_node] -o [output.dot] [input.dot]

SYNOPSIS

dijkstra [options] [files]

DESCRIPTION

dijkstra is a specialized Graphviz filter implementing Dijkstra's shortest path algorithm for graph analysis. It reads graph descriptions in DOT format, computes shortest paths between nodes, and outputs modified graphs with calculated distances or path information.The tool can calculate distance matrices showing the shortest path length between all pairs of nodes in a graph. It modifies graph attributes to reflect path calculations, which can then be used by other Graphviz layout tools for visualization.This utility is part of the Graphviz suite and is primarily used for network analysis, routing problems, and graph algorithm research. It processes graphs with weighted edges and can output results in various formats compatible with other Graphviz tools.

PARAMETERS

-o file

Output file.
-p node
Set source node for shortest path computation.
-d
Output distance matrix.

INSTALL

sudo apt install graphviz
sudo dnf install graphviz
sudo pacman -S graphviz
sudo apk add graphviz
sudo zypper install graphviz
brew install graphviz
nix profile install nixpkgs#graphviz

SEE ALSO

dot(1), neato(1), sfdp(1)