Skip to content

Commit

Permalink
perf!: Fix Subgraph O(n) complexity (#157)
Browse files Browse the repository at this point in the history
Replaced the `Subgraph = FilteredGraph` alias with a concrete definition
that avoids traversing the whole graph to filter nodes all the time.
Now `Subgraph::iter_nodes` is `O(nodes in subgraph)` instead of `O(n)`.

Closes #155.

BREAKING CHANGE: `Subgraph` is no longer an alias for `FilteredGraph`

---------

Co-authored-by: Douglas Wilson <[email protected]>
  • Loading branch information
aborgna-q and doug-q authored Nov 19, 2024
1 parent 9868d7b commit c2cd701
Show file tree
Hide file tree
Showing 2 changed files with 388 additions and 63 deletions.
4 changes: 0 additions & 4 deletions src/view/filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,6 @@ where
pub fn context(&self) -> &Ctx {
&self.context
}

pub(super) fn graph(&self) -> G {
self.graph.clone()
}
}

impl<G, F, Ctx> NodeFiltered<G, F, Ctx>
Expand Down
Loading

0 comments on commit c2cd701

Please sign in to comment.