Module petgraph::matrix_graph

source ·
Expand description

MatrixGraph<N, E, Ty, NullN, NullE, Ix> is a graph datastructure backed by an adjacency matrix.



  • Iterator over all edges of a graph.
  • Iterator over the edges of from or to a node
  • MatrixGraph<N, E, Ty, Null> is a graph datastructure using an adjacency matrix representation.
  • Iterator over the neighbors of a node.
  • Iterator over the node identifiers of a graph.
  • Iterator over all nodes of a graph.
  • NotZero is used to optimize the memory usage of edge weights E in a MatrixGraph, replacing the default Option<E> sentinel.


  • Wrapper trait for an Option, allowing user-defined structs to be input as containers when defining a null element.
  • Base trait for types that can be wrapped in a NotZero.


  • Short version of NodeIndex::new (with Ix = DefaultIx)

Type Definitions