Skip to content

Commit

Permalink
feat: Fastpath for is_node_convex on a single node (#153)
Browse files Browse the repository at this point in the history
Closes #152
  • Loading branch information
aborgna-q authored Nov 13, 2024
1 parent 6b83684 commit 2256901
Showing 1 changed file with 2 additions and 2 deletions.
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

0 comments on commit 2256901

Please sign in to comment.