MCPcopy Create free account
hub / github.com/douchuan/algorithm / check

Method check

src/graph/directed/order.rs:84–102  ·  view source on GitHub ↗

check that pre() and post() are consistent with pre[v] and post[v]

(&self)

Source from the content-addressed store, hash-verified

82
83 /// check that pre() and post() are consistent with pre[v] and post[v]
84 pub fn check(&self) -> Result<(), &'static str> {
85 let mut r = 0;
86 for &v in self.post() {
87 if self.post[v] != r {
88 return Err("post[v] and post() inconsistent");
89 }
90 r += 1;
91 }
92
93 r = 0;
94 for &v in self.pre() {
95 if self.pre[v] != r {
96 return Err("pre[v] and pre() inconsistent");
97 }
98 r += 1;
99 }
100
101 Ok(())
102 }
103}
104
105macro_rules! impl_from {

Callers

nothing calls this directly

Calls 3

ErrEnum · 0.85
postMethod · 0.80
preMethod · 0.80

Tested by

no test coverage detected