Trait traitgraph::interface::ImmutableGraphContainer
source · pub trait ImmutableGraphContainer: GraphBase {
type NodeIndices<'a>: Iterator<Item = Self::NodeIndex>
where Self: 'a;
type EdgeIndices<'a>: Iterator<Item = Self::EdgeIndex>
where Self: 'a;
type NodeIndicesCopied: Iterator<Item = Self::NodeIndex>;
type EdgeIndicesCopied: Iterator<Item = Self::EdgeIndex>;
Show 13 methods
// Required methods
fn node_indices(&self) -> Self::NodeIndices<'_>;
fn edge_indices(&self) -> Self::EdgeIndices<'_>;
fn node_indices_copied(&self) -> Self::NodeIndicesCopied;
fn edge_indices_copied(&self) -> Self::EdgeIndicesCopied;
fn contains_node_index(&self, node_id: Self::NodeIndex) -> bool;
fn contains_edge_index(&self, edge_id: Self::EdgeIndex) -> bool;
fn node_count(&self) -> usize;
fn edge_count(&self) -> usize;
fn node_data(&self, node_id: Self::NodeIndex) -> &Self::NodeData;
fn edge_data(&self, edge_id: Self::EdgeIndex) -> &Self::EdgeData;
fn edge_endpoints(&self, edge_id: Self::EdgeIndex) -> Edge<Self::NodeIndex>;
// Provided methods
fn is_empty(&self) -> bool { ... }
fn do_all_edges_endpoints_exist(&self) -> bool { ... }
}
Expand description
A container that contains a set of nodes and edges.
Graphs that implement this trait must have their nodes and edges indexed consecutively.
Required Associated Types§
sourcetype NodeIndices<'a>: Iterator<Item = Self::NodeIndex>
where
Self: 'a
type NodeIndices<'a>: Iterator<Item = Self::NodeIndex> where Self: 'a
An iterator type over the node indices in this graph.
sourcetype EdgeIndices<'a>: Iterator<Item = Self::EdgeIndex>
where
Self: 'a
type EdgeIndices<'a>: Iterator<Item = Self::EdgeIndex> where Self: 'a
An iterator type over the edge indices in this graph.
sourcetype NodeIndicesCopied: Iterator<Item = Self::NodeIndex>
type NodeIndicesCopied: Iterator<Item = Self::NodeIndex>
An iterator type over the node indices in this graph. The iterator is independent of the lifetime of self, and hence allows concurrent modifications during iteration. Note that any modification to the graph is not reflected in the iterator after construction.
sourcetype EdgeIndicesCopied: Iterator<Item = Self::EdgeIndex>
type EdgeIndicesCopied: Iterator<Item = Self::EdgeIndex>
An iterator type over the edge indices in this graph. The iterator is independent of the lifetime of self, and hence allows concurrent modifications during iteration. Note that any modification to the graph is not reflected in the iterator after construction.
Required Methods§
sourcefn node_indices(&self) -> Self::NodeIndices<'_>
fn node_indices(&self) -> Self::NodeIndices<'_>
Returns an iterator over the node indices in this graph.
sourcefn edge_indices(&self) -> Self::EdgeIndices<'_>
fn edge_indices(&self) -> Self::EdgeIndices<'_>
Returns an iterator over the edge indices in this graph.
sourcefn node_indices_copied(&self) -> Self::NodeIndicesCopied
fn node_indices_copied(&self) -> Self::NodeIndicesCopied
Returns an iterator over the node indices in this graph. The iterator is independent of the lifetime of self, and hence allows concurrent modifications during iteration. Note that any modification to the graph is not reflected in the iterator after construction.
sourcefn edge_indices_copied(&self) -> Self::EdgeIndicesCopied
fn edge_indices_copied(&self) -> Self::EdgeIndicesCopied
Returns an iterator over the edge indices in this graph. The iterator is independent of the lifetime of self, and hence allows concurrent modifications during iteration. Note that any modification to the graph is not reflected in the iterator after construction.
sourcefn contains_node_index(&self, node_id: Self::NodeIndex) -> bool
fn contains_node_index(&self, node_id: Self::NodeIndex) -> bool
Returns true if this graph contains the given node index.
sourcefn contains_edge_index(&self, edge_id: Self::EdgeIndex) -> bool
fn contains_edge_index(&self, edge_id: Self::EdgeIndex) -> bool
Returns true if this graph contains the given edge index.
sourcefn node_count(&self) -> usize
fn node_count(&self) -> usize
Returns the amount of nodes in this graph.
sourcefn edge_count(&self) -> usize
fn edge_count(&self) -> usize
Returns the amount of edges in this graph.
sourcefn node_data(&self, node_id: Self::NodeIndex) -> &Self::NodeData
fn node_data(&self, node_id: Self::NodeIndex) -> &Self::NodeData
Returns a reference to the node data associated with the given node id, or None if there is no such node.
sourcefn edge_data(&self, edge_id: Self::EdgeIndex) -> &Self::EdgeData
fn edge_data(&self, edge_id: Self::EdgeIndex) -> &Self::EdgeData
Returns a reference to the edge data associated with the given edge id, or None if there is no such edge.
sourcefn edge_endpoints(&self, edge_id: Self::EdgeIndex) -> Edge<Self::NodeIndex>
fn edge_endpoints(&self, edge_id: Self::EdgeIndex) -> Edge<Self::NodeIndex>
Returns the endpoints of an edge.
Provided Methods§
sourcefn is_empty(&self) -> bool
fn is_empty(&self) -> bool
Returns true if the graph is empty, i.e. contains no nodes or edges.
sourcefn do_all_edges_endpoints_exist(&self) -> bool
fn do_all_edges_endpoints_exist(&self) -> bool
Returns true if the nodes returned by edge_endpoints
are part of the graph for all edges.