Module traitgraph::interface

source ·
Expand description

The graph traits.

The traits are roughly split up by different access types:

  • immutable reference (ImmutableGraphContainer)
  • mutable reference (MutableGraphContainer)
  • immutable reference that must outlive the return value (TraversableGraph)

As it happens, the access types match well to common graph use cases, i.e. queries for nodes and edges, adding and removing nodes and edges as well as iterating over the neighbors of a node.

Modules

  • A set of traits for subgraphs. A subgraph is a graph that is backed by an actual graph implementation, but that filters out some nodes or edges.

Structs

  • An edge represented as a pair of node indices.
  • The neighbor of a node, given as the edge used to reach the neighbor node as well as the neighbor node itself.

Enums

  • An enum encoding an index that can either be a node index or an edge index.

Traits

  • A graph implementing all common graph traits, including those requiring mutable access. This is a useful shortcut for generic type bounds when the graph should be mutated.
  • Contains the associated types of a graph.
  • A container that contains a set of nodes and edges.
  • A container that allows adding and removing nodes and edges.
  • A graph that can be navigated, i.e. that can iterate the neighbors of its nodes.
  • A graph implementing all common graph traits that do not require mutable access. This is a useful shortcut for generic type bounds when the graph should not be mutated.
  • A helper trait to get the correct walk type from a graph. This is the factory pattern, where a graph is a factory for walks.