Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Fastpath for is_node_convex on a single node #153

Merged
merged 1 commit into from
Nov 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/algorithms/convex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ where
/// Whether the subgraph induced by the node set is convex.
///
/// An induced subgraph is convex if there is no node that is both in the
/// past and in the future of another node of the subgraph.
/// past and in the future of some nodes in the subgraph.
///
/// This function requires mutable access to `self` because it uses a
/// temporary data structure within the object.
Expand All @@ -103,7 +103,7 @@ where
pub fn is_node_convex(&self, nodes: impl IntoIterator<Item = NodeIndex>) -> bool {
// The nodes in the subgraph, in topological order.
let nodes: BTreeSet<_> = nodes.into_iter().map(|n| self.topsort_ind[n]).collect();
if nodes.is_empty() {
if nodes.len() <= 1 {
return true;
}

Expand Down
Loading