pub trait FiniteGraph: GraphType {
type NodeIt<'a>: GraphIterator<Self, Item = Self::Node<'a>>
where Self: 'a;
type EdgeIt<'a>: GraphIterator<Self, Item = Self::Edge<'a>>
where Self: 'a;
// Required methods
fn num_nodes(&self) -> usize;
fn num_edges(&self) -> usize;
fn nodes_iter(&self) -> Self::NodeIt<'_>;
fn edges_iter(&self) -> Self::EdgeIt<'_>;
fn enodes(&self, e: Self::Edge<'_>) -> (Self::Node<'_>, Self::Node<'_>);
// Provided methods
fn nodes(&self) -> NodeIterator<'_, Self>
where Self: Sized { ... }
fn edges(&self) -> EdgeIterator<'_, Self>
where Self: Sized { ... }
}
Expand description
A (finite) graph with a known number of nodes and edges.
Finite graphs also provide access to the list of all nodes and edges.
Required Associated Types§
Sourcetype NodeIt<'a>: GraphIterator<Self, Item = Self::Node<'a>>
where
Self: 'a
type NodeIt<'a>: GraphIterator<Self, Item = Self::Node<'a>> where Self: 'a
Type of an iterator over all nodes.
Sourcetype EdgeIt<'a>: GraphIterator<Self, Item = Self::Edge<'a>>
where
Self: 'a
type EdgeIt<'a>: GraphIterator<Self, Item = Self::Edge<'a>> where Self: 'a
Type of an iterator over all edges.
Required Methods§
Sourcefn nodes_iter(&self) -> Self::NodeIt<'_>
fn nodes_iter(&self) -> Self::NodeIt<'_>
Return a graph iterator over all nodes.
Sourcefn edges_iter(&self) -> Self::EdgeIt<'_>
fn edges_iter(&self) -> Self::EdgeIt<'_>
Return a graph iterator over all edges.
This iterator traverses only the forward edges.
Provided Methods§
Sourcefn nodes(&self) -> NodeIterator<'_, Self>where
Self: Sized,
fn nodes(&self) -> NodeIterator<'_, Self>where
Self: Sized,
Return an iterator over all nodes.
Sourcefn edges(&self) -> EdgeIterator<'_, Self>where
Self: Sized,
fn edges(&self) -> EdgeIterator<'_, Self>where
Self: Sized,
Return an iterator over all edges.
This iterator traverses only the forward edges.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.