pub struct Relation<A: Clone + Eq + Hash> {
pub domain: Vec<A>,
pub pairs: HashSet<(usize, usize)>,
}Expand description
Finite relation as a set of ordered pairs.
Fields§
§domain: Vec<A>§pairs: HashSet<(usize, usize)>Implementations§
Source§impl<A: Clone + Eq + Hash> Relation<A>
impl<A: Clone + Eq + Hash> Relation<A>
pub fn new(domain: Vec<A>) -> Self
pub fn add_pair(&mut self, a: &A, b: &A)
pub fn contains(&self, a: &A, b: &A) -> bool
pub fn is_reflexive(&self) -> bool
pub fn is_symmetric(&self) -> bool
pub fn is_transitive(&self) -> bool
pub fn is_equivalence(&self) -> bool
pub fn is_antisymmetric(&self) -> bool
pub fn is_partial_order(&self) -> bool
pub fn equivalence_class(&self, a: &A) -> Vec<A>
Trait Implementations§
Auto Trait Implementations§
impl<A> Freeze for Relation<A>
impl<A> RefUnwindSafe for Relation<A>where
A: RefUnwindSafe,
impl<A> Send for Relation<A>where
A: Send,
impl<A> Sync for Relation<A>where
A: Sync,
impl<A> Unpin for Relation<A>where
A: Unpin,
impl<A> UnsafeUnpin for Relation<A>
impl<A> UnwindSafe for Relation<A>where
A: UnwindSafe,
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