Module prepona::storage[][src]

Storages are structures that graphs use to store information about vertices and edges.

There are two storage types that are supported:

  • Adjacency matrix: Is a matrix used to represent a finite graph. The elements of the matrix indicate whether pairs of vertices are adjacent or not in the graph. For more info read AdjMatrix.
  • Adjacency list: Is a collection of unordered lists used to represent a finite graph. Each list describes the set of neighbors of a vertex in the graph. For more info read AdjList

Each storage must implement the GraphStorage trait. So You can create your own storage and after implementing the GraphStorage, pass it to the graph to use it as backend storage of the graph.

For a more informed decision regarding to which storage to choose, checkout documentation of each storage and compare their memory usage and time complexity of each operation.

Structs

AdjList

AdjList is a collection of unordered lists used to represent a finite graph. Each list describes the set of neighbors of a vertex in the graph.

AdjMap

AdjMap is a two-layer hash map in the form of: (source id) -> (destination id) -> (list of edges from source to destination).

AdjMatrix

AdjMatrix is a matrix used to represent a finite graph. The elements of the matrix indicate whether pairs of vertices are adjacent or not in the graph.

Error

Error type returned by storages in storage module.

Enums

ErrorKind

Types of errors that may happen when using a graph storage.

Traits

GraphStorage

Defines the api that a storage must provide in order to be usable for storing graph data.

Type Definitions

DiFlowList

An adjacency list that uses directed flow edges.

DiFlowMap

An adjacency map that uses directed flow edges.

DiFlowMat

An adjacency matrix that uses directed flow edges.

DiList

An adjacency list that uses directed default edges.

DiMap

An adjacency map that uses directed default edges.

DiMat

An adjacency matrix that uses directed default edges.

FlowList

An adjacency list that uses undirected flow edges.

FlowMap

An adjacency map that uses undirected flow edges.

FlowMat

An adjacency matrix that uses undirected flow edges.

List

An adjacency list that uses undirected default edges.

Map

An adjacency map that uses undirected default edges.

Mat

An adjacency matrix that uses undirected default edges.