Allow transforming graph before commands
This commit is contained in:
parent
ab7b7295ca
commit
c573f1b0b0
8 changed files with 134 additions and 17 deletions
|
|
@ -192,6 +192,22 @@ impl Data {
|
|||
Self::read(&mut file)
|
||||
}
|
||||
|
||||
pub fn check_consistency(&self) {
|
||||
assert_eq!(
|
||||
self.pages.len(),
|
||||
self.graph.nodes.len(),
|
||||
"inconsistent number of pages"
|
||||
);
|
||||
|
||||
assert_eq!(
|
||||
self.links.len(),
|
||||
self.graph.edges.len(),
|
||||
"inconsistent number of links"
|
||||
);
|
||||
|
||||
self.graph.check_consistency();
|
||||
}
|
||||
|
||||
pub fn redirect_target(&self, node: NodeIdx) -> Option<NodeIdx> {
|
||||
if !self.pages[node.usize()].redirect {
|
||||
return None;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue