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
type ParentGraph: GraphBase
type ParentGraph: GraphBase
The type of the associated parent graph.
type ParentGraphRef: Borrow<Self::ParentGraph>
type ParentGraphRef: Borrow<Self::ParentGraph>
The type of the reference to the associated parent graph.
Required methods
fn new_empty(graph: Self::ParentGraphRef) -> Self
fn new_empty(graph: Self::ParentGraphRef) -> Self
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.
fn new_full(graph: Self::ParentGraphRef) -> Self
fn new_full(graph: Self::ParentGraphRef) -> Self
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.
fn parent_graph(&self) -> &Self::ParentGraph
fn parent_graph(&self) -> &Self::ParentGraph
Returns a reference to the original graph.
fn contains_node(
&self,
node_index: <Self::ParentGraph as GraphBase>::NodeIndex
) -> bool
fn contains_node(
&self,
node_index: <Self::ParentGraph as GraphBase>::NodeIndex
) -> bool
Returns true if the given node id is part of the subgraph.
fn contains_edge(
&self,
edge_index: <Self::ParentGraph as GraphBase>::EdgeIndex
) -> bool
fn contains_edge(
&self,
edge_index: <Self::ParentGraph as GraphBase>::EdgeIndex
) -> bool
Returns true if the given edge id is part of the subgraph.
fn add_node(&mut self, node_index: <Self::ParentGraph as GraphBase>::NodeIndex)
fn add_node(&mut self, node_index: <Self::ParentGraph as GraphBase>::NodeIndex)
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.
fn add_edge(&mut self, edge_index: <Self::ParentGraph as GraphBase>::EdgeIndex)
fn add_edge(&mut self, edge_index: <Self::ParentGraph as GraphBase>::EdgeIndex)
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.
fn remove_node(
&mut self,
node_index: <Self::ParentGraph as GraphBase>::NodeIndex
)
fn remove_node(
&mut self,
node_index: <Self::ParentGraph as GraphBase>::NodeIndex
)
Removes the given node id from the graph.
fn remove_edge(
&mut self,
edge_index: <Self::ParentGraph as GraphBase>::EdgeIndex
)
fn remove_edge(
&mut self,
edge_index: <Self::ParentGraph as GraphBase>::EdgeIndex
)
Removes the given edge id from the graph.
fn node_count(&self) -> usize
fn node_count(&self) -> usize
Returns the amount of nodes in the subgraph.
fn edge_count(&self) -> usize
fn edge_count(&self) -> usize
Returns the amount of edges in the subgraph.