Trait traitgraph::interface::MutableGraphContainer [−][src]
pub trait MutableGraphContainer: ImmutableGraphContainer {
fn add_node(&mut self, node_data: Self::NodeData) -> Self::NodeIndex;
fn add_edge(
&mut self,
from: Self::NodeIndex,
to: Self::NodeIndex,
edge_data: Self::EdgeData
) -> Self::EdgeIndex;
fn remove_node(
&mut self,
node_id: Self::NodeIndex
) -> Option<Self::NodeData>;
fn remove_edge(
&mut self,
edge_id: Self::EdgeIndex
) -> Option<Self::EdgeData>;
fn remove_edges_sorted(&mut self, edge_ids: &[Self::EdgeIndex]);
fn clear(&mut self);
}
Expand description
A container that allows adding and removing nodes and edges.
Required methods
Adds a new node with the given NodeData
to the graph.
Adds a new edge with the given EdgeData
to the graph.
fn remove_node(&mut self, node_id: Self::NodeIndex) -> Option<Self::NodeData>
fn remove_node(&mut self, node_id: Self::NodeIndex) -> Option<Self::NodeData>
Removes the node with the given id from the graph. Note that this may change the ids of existing nodes.
fn remove_edge(&mut self, edge_id: Self::EdgeIndex) -> Option<Self::EdgeData>
fn remove_edge(&mut self, edge_id: Self::EdgeIndex) -> Option<Self::EdgeData>
Removes the edge with the given id from the graph. Note that this may change the ids of existing edges.
fn remove_edges_sorted(&mut self, edge_ids: &[Self::EdgeIndex])
fn remove_edges_sorted(&mut self, edge_ids: &[Self::EdgeIndex])
Removes the edges with the given ids from the graph. The ids are expected to be given in sorted order.
Note that this may change the ids of existing edges.