check that pre() and post() are consistent with pre[v] and post[v]
(&self)
| 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 | |
| 105 | macro_rules! impl_from { |