pub trait MutableGraphContainer: ImmutableGraphContainer {
    // Required methods
    fn node_data_mut(&mut self, node_id: Self::NodeIndex) -> &mut Self::NodeData;
    fn edge_data_mut(&mut self, edge_id: Self::EdgeIndex) -> &mut Self::EdgeData;
    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);

    // Provided method
    fn remove_nodes_sorted_slice(&mut self, node_ids: &[Self::NodeIndex]) { ... }
}
Expand description

A container that allows adding and removing nodes and edges.

Required Methods§

source

fn node_data_mut(&mut self, node_id: Self::NodeIndex) -> &mut Self::NodeData

Returns a mutable reference to the node data associated with the given node id, or None if there is no such node.

source

fn edge_data_mut(&mut self, edge_id: Self::EdgeIndex) -> &mut Self::EdgeData

Returns a mutable reference to the edge data associated with the given edge id, or None if there is no such edge.

source

fn add_node(&mut self, node_data: Self::NodeData) -> Self::NodeIndex

Adds a new node with the given NodeData to the graph.

source

fn add_edge( &mut self, from: Self::NodeIndex, to: Self::NodeIndex, edge_data: Self::EdgeData ) -> Self::EdgeIndex

Adds a new edge with the given EdgeData to the graph.

source

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.

source

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.

source

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.

source

fn clear(&mut self)

Removes all nodes and edges from the graph.

Provided Methods§

source

fn remove_nodes_sorted_slice(&mut self, node_ids: &[Self::NodeIndex])

Removes all nodes with the given ids from the graph. The nodes must be passed as a slice and sorted in ascending order. Note that this may change the ids of existing nodes.

Implementors§

source§

impl<NodeData, EdgeData> MutableGraphContainer for PetGraph<NodeData, EdgeData>