pub struct CompoundBase<InnerGraph, InnerForest>{ /* private fields */ }Expand description
A compound graph is a graph with a parallel forest that puts the nodes of the graph into a hierarchy.
The sets of edges of the graph and the forest are disjoint. The set of nodes between the graph and the tree are identical.
Implementations§
Source§impl<InnerGraph, InnerForest> CompoundBase<InnerGraph, InnerForest>where
InnerGraph: MutableGraph,
InnerForest: MutableForest<GData = (), NData = (), EData = ()> + Default,
impl<InnerGraph, InnerForest> CompoundBase<InnerGraph, InnerForest>where
InnerGraph: MutableGraph,
InnerForest: MutableForest<GData = (), NData = (), EData = ()> + Default,
pub fn new_with_graph_and_forest( graph: InnerGraph, forest: InnerForest, ) -> Result<Self>
pub fn new_with_graph(graph: InnerGraph) -> Result<Self>
Source§impl<InnerGraph, InnerForest> CompoundBase<InnerGraph, InnerForest>where
InnerGraph: MutableGraph + Default,
InnerForest: MutableForest<GData = (), NData = (), EData = ()> + Default,
impl<InnerGraph, InnerForest> CompoundBase<InnerGraph, InnerForest>where
InnerGraph: MutableGraph + Default,
InnerForest: MutableForest<GData = (), NData = (), EData = ()> + Default,
pub fn new() -> Self
pub fn new_with_forest(forest: InnerForest) -> Result<Self>
pub fn graph(&self) -> &InnerGraph
pub fn forest(&self) -> &InnerForest
Source§impl<InnerGraph, InnerForest> CompoundBase<InnerGraph, InnerForest>where
InnerGraph: MutableGraph + Serialize,
InnerForest: MutableForest<GData = (), NData = (), EData = ()> + Serialize,
impl<InnerGraph, InnerForest> CompoundBase<InnerGraph, InnerForest>where
InnerGraph: MutableGraph + Serialize,
InnerForest: MutableForest<GData = (), NData = (), EData = ()> + Serialize,
Source§impl<'de, InnerGraph, InnerForest> CompoundBase<InnerGraph, InnerForest>where
InnerGraph: MutableGraph + Deserialize<'de>,
InnerForest: MutableForest<GData = (), NData = (), EData = ()> + Deserialize<'de> + Default,
impl<'de, InnerGraph, InnerForest> CompoundBase<InnerGraph, InnerForest>where
InnerGraph: MutableGraph + Deserialize<'de>,
InnerForest: MutableForest<GData = (), NData = (), EData = ()> + Deserialize<'de> + Default,
Trait Implementations§
Source§impl<InnerGraph, InnerForest> Clone for CompoundBase<InnerGraph, InnerForest>where
InnerGraph: MutableGraph + Clone,
InnerForest: MutableForest<GData = (), NData = (), EData = ()> + Clone,
impl<InnerGraph, InnerForest> Clone for CompoundBase<InnerGraph, InnerForest>where
InnerGraph: MutableGraph + Clone,
InnerForest: MutableForest<GData = (), NData = (), EData = ()> + Clone,
Source§fn clone(&self) -> CompoundBase<InnerGraph, InnerForest>
fn clone(&self) -> CompoundBase<InnerGraph, InnerForest>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<InnerGraph, InnerForest> Debug for CompoundBase<InnerGraph, InnerForest>where
InnerGraph: MutableGraph + Debug,
InnerForest: MutableForest<GData = (), NData = (), EData = ()> + Debug,
impl<InnerGraph, InnerForest> Debug for CompoundBase<InnerGraph, InnerForest>where
InnerGraph: MutableGraph + Debug,
InnerForest: MutableForest<GData = (), NData = (), EData = ()> + Debug,
Source§impl<InnerGraph, InnerForest> Default for CompoundBase<InnerGraph, InnerForest>where
InnerGraph: MutableGraph + Default,
InnerForest: MutableForest<GData = (), NData = (), EData = ()> + Default,
impl<InnerGraph, InnerForest> Default for CompoundBase<InnerGraph, InnerForest>where
InnerGraph: MutableGraph + Default,
InnerForest: MutableForest<GData = (), NData = (), EData = ()> + Default,
Source§impl<'de, InnerGraph, InnerForest> Deserialize<'de> for CompoundBase<InnerGraph, InnerForest>where
InnerGraph: MutableGraph + Deserialize<'de>,
InnerForest: MutableForest<GData = (), NData = (), EData = ()> + Deserialize<'de> + Default,
impl<'de, InnerGraph, InnerForest> Deserialize<'de> for CompoundBase<InnerGraph, InnerForest>where
InnerGraph: MutableGraph + Deserialize<'de>,
InnerForest: MutableForest<GData = (), NData = (), EData = ()> + Deserialize<'de> + Default,
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<InnerGraph, InnerForest> Display for CompoundBase<InnerGraph, InnerForest>where
InnerGraph: MutableGraph + Serialize,
InnerForest: MutableForest<GData = (), NData = (), EData = ()> + Serialize,
impl<InnerGraph, InnerForest> Display for CompoundBase<InnerGraph, InnerForest>where
InnerGraph: MutableGraph + Serialize,
InnerForest: MutableForest<GData = (), NData = (), EData = ()> + Serialize,
Source§impl<InnerGraph, InnerForest> MutableCompound for CompoundBase<InnerGraph, InnerForest>
impl<InnerGraph, InnerForest> MutableCompound for CompoundBase<InnerGraph, InnerForest>
fn add_node_with_data( &mut self, node: impl AsRef<NodeID>, parent: Option<impl AsRef<NodeID>>, edge: impl AsRef<EdgeID>, node_data: InnerGraph::NData, ) -> Result<()>
fn remove_node_ungrouping(&mut self, id: impl AsRef<NodeID>) -> Result<()>
fn remove_node_and_children(&mut self, id: impl AsRef<NodeID>) -> Result<Nodes>
fn remove_children(&mut self, id: impl AsRef<NodeID>) -> Result<Nodes>
fn add_edge_with_data( &mut self, edge: impl AsRef<EdgeID>, source: impl AsRef<NodeID>, target: impl AsRef<NodeID>, edge_data: InnerGraph::EData, ) -> Result<()>
fn remove_edge(&mut self, id: impl AsRef<EdgeID>) -> Result<()>
fn clear_edges(&mut self, id: impl AsRef<NodeID>) -> Result<()>
fn move_node( &mut self, id: impl AsRef<NodeID>, new_parent: Option<impl AsRef<NodeID>>, ) -> Result<()>
fn move_edge( &mut self, id: impl AsRef<EdgeID>, new_source: impl AsRef<NodeID>, new_target: impl AsRef<NodeID>, ) -> Result<()>
fn set_data(&mut self, data: InnerGraph::GData)
fn with_data(&mut self, transform: &dyn Fn(&mut InnerGraph::GData))
fn set_node_data( &mut self, id: impl AsRef<NodeID>, data: InnerGraph::NData, ) -> Result<()>
fn with_node_data( &mut self, id: impl AsRef<NodeID>, transform: &dyn Fn(&mut InnerGraph::NData), ) -> Result<()>
fn set_edge_data( &mut self, id: impl AsRef<EdgeID>, data: InnerGraph::EData, ) -> Result<()>
fn with_edge_data( &mut self, id: impl AsRef<EdgeID>, transform: &dyn Fn(&mut InnerGraph::EData), ) -> Result<()>
fn adding_node_with_data( &self, node: impl AsRef<NodeID>, parent: Option<impl AsRef<NodeID>>, edge: impl AsRef<EdgeID>, node_data: Self::NData, ) -> Result<Self>
fn add_node( &mut self, node: impl AsRef<NodeID>, parent: Option<impl AsRef<NodeID>>, edge: impl AsRef<EdgeID>, ) -> Result<()>
fn adding_node( &self, node: impl AsRef<NodeID>, parent: Option<impl AsRef<NodeID>>, edge: impl AsRef<EdgeID>, ) -> Result<Self>
fn moving_node( &self, id: impl AsRef<NodeID>, new_parent: Option<impl AsRef<NodeID>>, ) -> Result<Self>
fn removing_node_ungrouping(&self, id: impl AsRef<NodeID>) -> Result<Self>
fn removing_node_and_children(&self, id: impl AsRef<NodeID>) -> Result<Self>
fn removing_children(&self, id: impl AsRef<NodeID>) -> Result<Self>
fn adding_edge_with_data( &self, edge: impl AsRef<EdgeID>, source: impl AsRef<NodeID>, target: impl AsRef<NodeID>, edge_data: Self::EData, ) -> Result<Self>
fn add_edge( &mut self, edge: impl AsRef<EdgeID>, source: impl AsRef<NodeID>, target: impl AsRef<NodeID>, ) -> Result<()>
fn adding_edge( &self, edge: impl AsRef<EdgeID>, source: impl AsRef<NodeID>, target: impl AsRef<NodeID>, ) -> Result<Self>
fn removing_edge(&self, id: impl AsRef<EdgeID>) -> Result<Self>
fn clearing_edges(&self, id: impl AsRef<NodeID>) -> Result<Self>
fn setting_data(&self, data: Self::GData) -> Self
fn setting_node_data( &self, id: impl AsRef<NodeID>, data: Self::NData, ) -> Result<Self>
fn setting_edge_data( &self, id: impl AsRef<EdgeID>, data: Self::EData, ) -> Result<Self>
Source§impl<InnerGraph, InnerForest> PartialEq for CompoundBase<InnerGraph, InnerForest>where
InnerGraph: MutableGraph + PartialEq,
InnerForest: MutableForest<GData = (), NData = (), EData = ()> + PartialEq,
impl<InnerGraph, InnerForest> PartialEq for CompoundBase<InnerGraph, InnerForest>where
InnerGraph: MutableGraph + PartialEq,
InnerForest: MutableForest<GData = (), NData = (), EData = ()> + PartialEq,
Source§fn eq(&self, other: &CompoundBase<InnerGraph, InnerForest>) -> bool
fn eq(&self, other: &CompoundBase<InnerGraph, InnerForest>) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl<InnerGraph, InnerForest> Serialize for CompoundBase<InnerGraph, InnerForest>where
InnerGraph: MutableGraph + Serialize,
InnerForest: MutableForest<GData = (), NData = (), EData = ()> + Serialize,
impl<InnerGraph, InnerForest> Serialize for CompoundBase<InnerGraph, InnerForest>where
InnerGraph: MutableGraph + Serialize,
InnerForest: MutableForest<GData = (), NData = (), EData = ()> + Serialize,
Source§impl<InnerGraph, InnerForest> VisitableForest for CompoundBase<InnerGraph, InnerForest>
impl<InnerGraph, InnerForest> VisitableForest for CompoundBase<InnerGraph, InnerForest>
fn in_edge(&self, node: impl AsRef<NodeID>) -> Result<Option<EdgeID>>
fn in_edge_with_root(&self, node: impl AsRef<NodeID>) -> Result<Option<EdgeID>>
fn parent(&self, node: impl AsRef<NodeID>) -> Result<Option<NodeID>>
fn children(&self, node: Option<impl AsRef<NodeID>>) -> Result<Nodes>
fn has_children(&self, node: impl AsRef<NodeID>) -> Result<bool>
fn child_count(&self, node: impl AsRef<NodeID>) -> Result<usize>
fn descendants(&self, nodes: &Nodes) -> Result<Nodes>
fn ancestors(&self, nodes: &Nodes) -> Result<Nodes>
Source§impl<InnerGraph, InnerForest> VisitableGraph for CompoundBase<InnerGraph, InnerForest>
impl<InnerGraph, InnerForest> VisitableGraph for CompoundBase<InnerGraph, InnerForest>
type GData = <InnerGraph as VisitableGraph>::GData
type NData = <InnerGraph as VisitableGraph>::NData
type EData = <InnerGraph as VisitableGraph>::EData
Source§fn node_data(&self, id: impl AsRef<NodeID>) -> Result<Cow<'static, Self::NData>>
fn node_data(&self, id: impl AsRef<NodeID>) -> Result<Cow<'static, Self::NData>>
Returns a reference to the node’s data.
Source§fn edge_data(&self, id: impl AsRef<EdgeID>) -> Result<Cow<'static, Self::EData>>
fn edge_data(&self, id: impl AsRef<EdgeID>) -> Result<Cow<'static, Self::EData>>
Returns a reference to the edge’s data.
Source§fn node_count(&self) -> usize
fn node_count(&self) -> usize
Returns the number of nodes in the graph.
Source§fn edge_count(&self) -> usize
fn edge_count(&self) -> usize
Returns the number of edges in the graph.
Source§fn has_node(&self, id: impl AsRef<NodeID>) -> bool
fn has_node(&self, id: impl AsRef<NodeID>) -> bool
Returns
true if the graph contains the given node.Source§fn has_edge(&self, id: impl AsRef<EdgeID>) -> bool
fn has_edge(&self, id: impl AsRef<EdgeID>) -> bool
Returns
true if the graph contains the given edge.Source§fn has_edge_from_to(
&self,
source: impl AsRef<NodeID>,
target: impl AsRef<NodeID>,
) -> bool
fn has_edge_from_to( &self, source: impl AsRef<NodeID>, target: impl AsRef<NodeID>, ) -> bool
Returns
true if the graph contains an edge from source to target.Source§fn has_edge_between(&self, a: impl AsRef<NodeID>, b: impl AsRef<NodeID>) -> bool
fn has_edge_between(&self, a: impl AsRef<NodeID>, b: impl AsRef<NodeID>) -> bool
Returns
true if the graph contains an edge between a and b,
regardless of direction.Source§fn source(&self, id: impl AsRef<EdgeID>) -> Result<NodeID>
fn source(&self, id: impl AsRef<EdgeID>) -> Result<NodeID>
Returns the source node of the edge.
Source§fn target(&self, id: impl AsRef<EdgeID>) -> Result<NodeID>
fn target(&self, id: impl AsRef<EdgeID>) -> Result<NodeID>
Returns the target node of the edge.
Source§fn endpoints(&self, id: impl AsRef<EdgeID>) -> Result<(NodeID, NodeID)>
fn endpoints(&self, id: impl AsRef<EdgeID>) -> Result<(NodeID, NodeID)>
Returns the endpoints of the edge.
Source§fn out_edges(&self, id: impl AsRef<NodeID>) -> Result<Edges>
fn out_edges(&self, id: impl AsRef<NodeID>) -> Result<Edges>
Returns the out-edges of the node.
Source§fn incident_edges(&self, id: impl AsRef<NodeID>) -> Result<Edges>
fn incident_edges(&self, id: impl AsRef<NodeID>) -> Result<Edges>
Returns the incident edges of the node.
Source§fn out_degree(&self, id: impl AsRef<NodeID>) -> Result<usize>
fn out_degree(&self, id: impl AsRef<NodeID>) -> Result<usize>
Returns the number of out-edges of the node.
Source§fn in_degree(&self, id: impl AsRef<NodeID>) -> Result<usize>
fn in_degree(&self, id: impl AsRef<NodeID>) -> Result<usize>
Returns the number of in-edges of the node.
Source§fn degree(&self, id: impl AsRef<NodeID>) -> Result<usize>
fn degree(&self, id: impl AsRef<NodeID>) -> Result<usize>
Returns the number of incident edges of the node.
Source§fn successors(&self, id: impl AsRef<NodeID>) -> Result<Nodes>
fn successors(&self, id: impl AsRef<NodeID>) -> Result<Nodes>
Returns the immediate successors of the node.
Source§fn predecessors(&self, id: impl AsRef<NodeID>) -> Result<Nodes>
fn predecessors(&self, id: impl AsRef<NodeID>) -> Result<Nodes>
Returns the immediate predecessors of the node.
Source§fn neighbors(&self, id: impl AsRef<NodeID>) -> Result<Nodes>
fn neighbors(&self, id: impl AsRef<NodeID>) -> Result<Nodes>
Returns the immediate neighbors of the node.
Source§fn has_successors(&self, id: impl AsRef<NodeID>) -> Result<bool>
fn has_successors(&self, id: impl AsRef<NodeID>) -> Result<bool>
Returns
true if the node has successors.Source§fn has_predecessors(&self, id: impl AsRef<NodeID>) -> Result<bool>
fn has_predecessors(&self, id: impl AsRef<NodeID>) -> Result<bool>
Returns
true if the node has predecessors.Source§fn has_neighbors(&self, id: impl AsRef<NodeID>) -> Result<bool>
fn has_neighbors(&self, id: impl AsRef<NodeID>) -> Result<bool>
Returns
true if the node has neighbors.Source§fn all_roots(&self) -> Nodes
fn all_roots(&self) -> Nodes
The set of all “roots” (nodes with no predecessors) in the graph.
Source§fn all_leaves(&self) -> Nodes
fn all_leaves(&self) -> Nodes
The set of all “leaves” (nodes with no successors) in the graph.
Source§fn non_roots(&self) -> Nodes
fn non_roots(&self) -> Nodes
The set of all nodes that are not roots (i.e., nodes with at least one predecessor).
Source§fn non_leaves(&self) -> Nodes
fn non_leaves(&self) -> Nodes
The set of all nodes that are not leaves (i.e., nodes with at least one successor).
Source§fn all_internals(&self) -> Nodes
fn all_internals(&self) -> Nodes
The set of all nodes that are neither roots nor leaves (i.e., nodes with
at least one predecessor and at least one successor).
Source§fn is_leaf(&self, id: impl AsRef<NodeID>) -> Result<bool>
fn is_leaf(&self, id: impl AsRef<NodeID>) -> Result<bool>
Returns
true if the node is a leaf (i.e., has no successors).Source§fn is_root(&self, id: impl AsRef<NodeID>) -> Result<bool>
fn is_root(&self, id: impl AsRef<NodeID>) -> Result<bool>
Returns
true if the node is a root (i.e., has no predecessors).Source§fn is_internal(&self, id: impl AsRef<NodeID>) -> Result<bool>
fn is_internal(&self, id: impl AsRef<NodeID>) -> Result<bool>
Returns
true if the node is neither a root nor a leaf (i.e., has at
least one predecessor and at least one successor).Source§fn edges_from_to(
&self,
source: impl AsRef<NodeID>,
target: impl AsRef<NodeID>,
) -> Result<Edges>
fn edges_from_to( &self, source: impl AsRef<NodeID>, target: impl AsRef<NodeID>, ) -> Result<Edges>
Returns the edges that have the given source and target nodes. Read more
Source§fn edges_between(
&self,
a: impl AsRef<NodeID>,
b: impl AsRef<NodeID>,
) -> Result<Edges>
fn edges_between( &self, a: impl AsRef<NodeID>, b: impl AsRef<NodeID>, ) -> Result<Edges>
Returns the edges that have the given nodes as endpoints. Read more
Source§fn edges_from_to_nodes(&self, sources: &Nodes, targets: &Nodes) -> Result<Edges>
fn edges_from_to_nodes(&self, sources: &Nodes, targets: &Nodes) -> Result<Edges>
Returns the edges connecting the given source nodes to the given target nodes.
Source§fn edges_between_nodes(&self, a: &Nodes, b: &Nodes) -> Result<Edges>
fn edges_between_nodes(&self, a: &Nodes, b: &Nodes) -> Result<Edges>
Returns the edges connecting the given sets of nodes.
Source§fn nodes_successors(&self, ids: &Nodes) -> Result<Nodes>
fn nodes_successors(&self, ids: &Nodes) -> Result<Nodes>
Returns the immediate successors of all the given nodes.
Source§fn nodes_predecessors(&self, ids: &Nodes) -> Result<Nodes>
fn nodes_predecessors(&self, ids: &Nodes) -> Result<Nodes>
Returns the immediate predecessors of all the given nodes.
impl<InnerGraph, InnerForest> Eq for CompoundBase<InnerGraph, InnerForest>where
InnerGraph: MutableGraph + Eq,
InnerForest: MutableForest<GData = (), NData = (), EData = ()> + Eq,
impl<InnerGraph, InnerForest> StructuralPartialEq for CompoundBase<InnerGraph, InnerForest>
impl<InnerGraph, InnerForest> VisitableCompound for CompoundBase<InnerGraph, InnerForest>
Auto Trait Implementations§
impl<InnerGraph, InnerForest> Freeze for CompoundBase<InnerGraph, InnerForest>
impl<InnerGraph, InnerForest> RefUnwindSafe for CompoundBase<InnerGraph, InnerForest>where
InnerGraph: RefUnwindSafe,
InnerForest: RefUnwindSafe,
impl<InnerGraph, InnerForest> Send for CompoundBase<InnerGraph, InnerForest>
impl<InnerGraph, InnerForest> Sync for CompoundBase<InnerGraph, InnerForest>
impl<InnerGraph, InnerForest> Unpin for CompoundBase<InnerGraph, InnerForest>
impl<InnerGraph, InnerForest> UnwindSafe for CompoundBase<InnerGraph, InnerForest>where
InnerGraph: UnwindSafe,
InnerForest: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more