diff options
Diffstat (limited to 'graph/src/lib.rs')
-rw-r--r-- | graph/src/lib.rs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/graph/src/lib.rs b/graph/src/lib.rs index 6813df3..6af7889 100644 --- a/graph/src/lib.rs +++ b/graph/src/lib.rs @@ -23,6 +23,7 @@ pub use adlist::ALGraph; pub mod labelled; pub use labelled::DLGraph; +pub use labelled::PLGraph; pub mod builder; @@ -252,6 +253,23 @@ pub trait ParentsGraph: Graph { fn parents_of(&self, node_id: usize) -> Result<<Self as ParentsGraph>::Iter<'_>, Error>; } +// TODO: Design a trait of graphs which can "replace" a certain child +// by another child. To re-direct children, so to speak. + +/// An /exended/ graph in the sense that it offers the ability to +/// "redirect" children of a node to another node. +pub trait RedirectGraph: Graph { + /// Replace the edge that points from `node_id` to the + /// `child_index`-th child by a new edge that points to + /// `new_child`. + fn redirect( + &mut self, + node_id: usize, + child_index: usize, + new_child: usize, + ) -> Result<(), Error>; +} + /// A labelled graph is just a graph with labels associated to /// vertices and / or edges. /// |