diff options
author | JSDurand <mmemmew@gmail.com> | 2023-01-06 23:42:28 +0800 |
---|---|---|
committer | JSDurand <mmemmew@gmail.com> | 2023-01-06 23:42:28 +0800 |
commit | f27d604d93ce583d4404e1874664e08382ea2f00 (patch) | |
tree | 6fa8df26af954e94f3604ffabde4961ee8108c41 /graph/src/lib.rs | |
parent | 7dd4935230e303aef8d295d992239d59d95b32d7 (diff) |
Save before system restart.
I am about to re-start my system, so I save before any crashes
happen.
Diffstat (limited to 'graph/src/lib.rs')
-rw-r--r-- | graph/src/lib.rs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/graph/src/lib.rs b/graph/src/lib.rs index 79f9646..26159c6 100644 --- a/graph/src/lib.rs +++ b/graph/src/lib.rs @@ -214,6 +214,19 @@ impl<T: Hash + Eq + PartialEq + Clone + Copy + Ord + PartialOrd + Display + Debu { } +/// A parents-knowing graph can return an iterator of parents for any +/// node. +pub trait ParentsGraph: Graph { + /// The type of an iterator that goes through the parents of a + /// node. + type Iter<'a>: Iterator<Item = usize> + 'a + where + Self: 'a; + + /// Return an iterator of parents for a node. + fn parents_of(&self, node_id: usize) -> Result<<Self as ParentsGraph>::Iter<'_>, Error>; +} + /// A labelled graph is just a graph with labels associated to /// vertices and / or edges. /// |