306 releases (107 breaking)

0.108.0 Nov 26, 2024
0.106.0 Nov 24, 2024
0.75.4 Jul 30, 2024
0.2.3 Mar 31, 2024

#241 in Algorithms

Download history 613/week @ 2024-08-12 923/week @ 2024-08-19 1134/week @ 2024-08-26 744/week @ 2024-09-02 1338/week @ 2024-09-09 1957/week @ 2024-09-16 693/week @ 2024-09-23 1847/week @ 2024-09-30 639/week @ 2024-10-07 141/week @ 2024-10-14 6/week @ 2024-11-04 189/week @ 2024-11-18 386/week @ 2024-11-25

581 downloads per month

MIT/Apache

1MB
16K SLoC

Graaf   Crates.io Build status API reference Coverage Status

Rust-powered directed graphs.

Table of Contents

Installation

Add this to your Cargo.toml:

[dependencies]
graaf = "0.108.0"

Representations

Arc-Weighted Sparse Digraphs

Unweighted Dense Digraphs

Unweighted Sparse Digraphs

Generators

  • Biclique generates a complete bipartite digraph.
  • Circuit generates a circuit digraph.
  • Complete generates a complete digraph.
  • Cycle generates a bidirectional circuit.
  • Empty generates a digraph without arcs.
  • ErdosRenyi generates a random digraph.
  • GrowingNetwork generates a growing network digraph.
  • Path generates a path digraph.
  • RandomTournament generates a random tournament.
  • Star generates a star digraph.
  • Wheel generates a wheel digraph.

Operations

Algorithms

Bellman-Ford-Moore

  • BellmanFordMoore::distances finds the shortest distances from a source vertex to all other vertices in an arc-weighted digraph with negative weights.

A breadth-first search explores an unweighted digraph's vertices in order of their distance from a source.

A depth-first search explores an unweighted digraph's vertices in order of their depth from a source.

  • Dfs iterates the vertices.
  • DfsDist iterates the vertices and their distance from the source.
  • DfsPred iterates the vertices and their predecessors.
  • DfsPred::predecessors finds the predecessors.

Dijkstra

Dijkstra's algorithm finds the shortest paths in an arc-weighted digraph.

Distance Matrix

A DistanceMatrix contains the shortest distances between all vertex pairs in a digraph.

Floyd-Warshall

Johnson's Circuit-Finding Algorithm

Predecessor Tree

A PredecessorTree contains the vertex predecessors.

Tarjan

Changelog

See CHANGELOG.md for a list of changes.

License

Licensed under Apache License, Version 2.0 or MIT license at your option.

Contact

Feel free to reach out with questions or suggestions.

No runtime deps