Trait traitgraph::interface::subgraph::DecoratingSubgraph[][src]

pub trait DecoratingSubgraph {
    type ParentGraph: GraphBase;
    type ParentGraphRef: Borrow<Self::ParentGraph>;
    fn new_empty(graph: Self::ParentGraphRef) -> Self;
fn new_full(graph: Self::ParentGraphRef) -> Self;
fn clear(&mut self);
fn parent_graph(&self) -> &Self::ParentGraph;
fn contains_node(
        &self,
        node_index: <Self::ParentGraph as GraphBase>::NodeIndex
    ) -> bool;
fn contains_edge(
        &self,
        edge_index: <Self::ParentGraph as GraphBase>::EdgeIndex
    ) -> bool;
fn add_node(
        &mut self,
        node_index: <Self::ParentGraph as GraphBase>::NodeIndex
    );
fn add_edge(
        &mut self,
        edge_index: <Self::ParentGraph as GraphBase>::EdgeIndex
    );
fn remove_node(
        &mut self,
        node_index: <Self::ParentGraph as GraphBase>::NodeIndex
    );
fn remove_edge(
        &mut self,
        edge_index: <Self::ParentGraph as GraphBase>::EdgeIndex
    );
fn node_count(&self) -> usize;
fn edge_count(&self) -> usize; }
Expand description

A subset of nodes and edges of a graph. There is not restriction on which nodes or edges must be contained in combination, so e.g. an edge from node 1 to node 4 can be contained, even if node 1 and node 4 are both not contained.

Associated Types

The type of the associated parent graph.

The type of the reference to the associated parent graph.

Required methods

Constructs a subgraph from the given graph without any nodes or edges. If not defined otherwise in the implementation, all node and edge ids of the given graph are valid arguments for the methods of this trait on the returned object.

Constructs a subgraph from the given graph with all nodes and edges. If not defined otherwise in the implementation, all node and edge ids of the given graph are valid arguments for the methods of this trait on the returned object.

Removes all nodes and edges from the subgraph.

Returns a reference to the original graph.

Returns true if the given node id is part of the subgraph.

Returns true if the given edge id is part of the subgraph.

Adds the given node id to the subgraph. Note that some implementations may require an initial set of nodes to be known when a subgraph is created, and inserting nodes outside of this initial set might panic.

Adds the given edge id to the subgraph. Note that some implementations may require an initial set of nodes to be known when a subgraph is created, and inserting nodes outside of this initial set might panic.

Removes the given node id from the graph.

Removes the given edge id from the graph.

Returns the amount of nodes in the subgraph.

Returns the amount of edges in the subgraph.

Implementors