Crate graaf

source ·
Expand description

§Graaf

Rust-powered directed graphs.

§Table of Contents

§Digraph Types

Graaf provides directed graphs representations. These types eagerly implement digraph operations and algorithms.

§Creating Digraphs

The gen module provides digraph generators. Each digraph representation can be constructed with the operations in the op module.

  • 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 with no arcs.
  • ErdosRenyi generates a random digraph.
  • RandomTournament generates a random tournament.
  • Star generates a star digraph.
  • Path generates a path digraph.

§Operations

The op module provides digraph operation traits. The digraph types implement these traits. One can implement these traits for custom digraph types. Operations form the foundation for algorithms.

§Algorithms

The algo module provides digraph algorithms.

§Bellman-Ford-Moore

The Bellman-Ford-Moore algorithm finds the shortest paths in an arc-weighted digraph with negative weights.

§Breadth-First Search (BFS)

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

§Depth-First Search (DFS)

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

  • dfs::Dfs iterates over the vertices.
  • dfs_dist::Dfs iterates over the vertices and their distance from the source.

§Dijkstra

Dijkstra’s algorithm finds the shortest paths from one or more source vertices in an arc-weighted digraph.

§Floyd-Warshall

The Floyd-Warshall algorithm finds the shortest paths between all pairs of vertices in an arc-weighted digraph.

§Tarjan

Tarjan’s algorithm finds the strongly connected components in a digraph.

§Predecessor Tree

A PredecessorTree is the result of a breadth-first search and contains the predecessors of the vertices on the shortest paths.

These functions produce a predecessor tree.

§Distance Matrix

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

§Naming Conventions

  • s denotes a source vertex.
  • t denotes a target vertex.
  • u denotes a tail vertex or the first vertex in scope.
  • v denotes a head vertex or the second vertex in scope.
  • w denotes the weight of an arc.
  • x denotes a tail vertex or the third vertex in scope.
  • y denotes a head vertex or the fourth vertex in scope.

Modules§

  • An adjacency list representation of an unweighted digraph
  • An adjacency list representation of an arc-weighted digraph
  • An adjacency matrix representation of an unweighted digraph
  • Digraph algorithms
  • An edge list representation of an unweighted digraph
  • Digraph generators.
  • Operations on digraphs