pub struct Relation { /* private fields */ }Implementations§
Source§impl Relation
impl Relation
Sourcepub fn insert(&mut self, src: Vertex, tgt: Vertex) -> bool
pub fn insert(&mut self, src: Vertex, tgt: Vertex) -> bool
Insert the edge (src, tgt). Returns true if it was not already present.
Sourcepub fn contains(&self, src: &Vertex, tgt: &Vertex) -> bool
pub fn contains(&self, src: &Vertex, tgt: &Vertex) -> bool
True when (src, tgt) is in the relation.
Sourcepub fn iter(&self) -> impl Iterator<Item = (&Vertex, &Vertex)>
pub fn iter(&self) -> impl Iterator<Item = (&Vertex, &Vertex)>
Iterate edges in canonical (lexicographic) order.
Sourcepub fn intersection(&self, other: &Relation) -> Relation
pub fn intersection(&self, other: &Relation) -> Relation
Edge set intersection.
Sourcepub fn difference(&self, other: &Relation) -> Relation
pub fn difference(&self, other: &Relation) -> Relation
Edge set difference.
Sourcepub fn image(&self, sources: &VertexSet) -> VertexSet
pub fn image(&self, sources: &VertexSet) -> VertexSet
Forward image: { y | exists x in sources, (x, y) in self }.
Sourcepub fn preimage(&self, targets: &VertexSet) -> VertexSet
pub fn preimage(&self, targets: &VertexSet) -> VertexSet
Backward image: { x | exists y in targets, (x, y) in self }.
Sourcepub fn transitive_closure(&self) -> Relation
pub fn transitive_closure(&self) -> Relation
Irreflexive transitive closure (E+).
Tarjan’s Strongly Connected Component algorithm, then DAG reachability propagation: O(V + E + sum(component-size^2)).
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Relation
impl<'de> Deserialize<'de> for Relation
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Relation
Source§impl<'a> IntoIterator for &'a Relation
impl<'a> IntoIterator for &'a Relation
impl StructuralPartialEq for Relation
Auto Trait Implementations§
impl Forget for Relation
impl Freeze for Relation
impl Move for Relation
impl RefUnwindSafe for Relation
impl Send for Relation
impl Sync for Relation
impl Unpin for Relation
impl UnsafeUnpin for Relation
impl UnwindSafe for Relation
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more