pub trait Graph: Debug {
type Node: Clone + Debug + Hash + Eq;
type Error: Error;
// Required method
fn is_ancestor(
&self,
ancestor: Self::Node,
descendant: Self::Node,
) -> Result<bool, Self::Error>;
// Provided methods
fn simplify_success_bounds(
&self,
nodes: HashSet<Self::Node>,
) -> Result<HashSet<Self::Node>, Self::Error> { ... }
fn simplify_failure_bounds(
&self,
nodes: HashSet<Self::Node>,
) -> Result<HashSet<Self::Node>, Self::Error> { ... }
}
Expand description
The set of nodes compromising a directed acyclic graph to be searched.
Required Associated Types§
Required Methods§
Sourcefn is_ancestor(
&self,
ancestor: Self::Node,
descendant: Self::Node,
) -> Result<bool, Self::Error>
fn is_ancestor( &self, ancestor: Self::Node, descendant: Self::Node, ) -> Result<bool, Self::Error>
Return whether or not node
is an ancestor of descendant
. A node X`` is said to be an "ancestor" of node
Y` if one of the following is true:
X == Y
X
is an immediate parent ofY
.X
is an ancestor of an immediate parent ofY
(defined recursively).
Provided Methods§
Sourcefn simplify_success_bounds(
&self,
nodes: HashSet<Self::Node>,
) -> Result<HashSet<Self::Node>, Self::Error>
fn simplify_success_bounds( &self, nodes: HashSet<Self::Node>, ) -> Result<HashSet<Self::Node>, Self::Error>
Filter nodes
to only include nodes that are not ancestors of any other
node in nodes
. This is not strictly necessary, but it improves
performance as some operations are linear in the size of the success
bounds, and it can make the intermediate results more sensible.
This operation is called heads
in e.g. Mercurial.
Sourcefn simplify_failure_bounds(
&self,
nodes: HashSet<Self::Node>,
) -> Result<HashSet<Self::Node>, Self::Error>
fn simplify_failure_bounds( &self, nodes: HashSet<Self::Node>, ) -> Result<HashSet<Self::Node>, Self::Error>
Filter nodes
to only include nodes that are not descendants of any
other node in nodes
. This is not strictly necessary, but it improves
performance as some operations are linear in the size of the failure
bounds, and it can make the intermediate results more sensible.
This operation is called roots
in e.g. Mercurial.