pub struct Matching<G: GraphBase> { /* private fields */ }
Expand description

Computed matching of the graph.

Implementations§

source§

impl<G> Matching<G>where G: NodeIndexable,

source

pub fn mate(&self, node: G::NodeId) -> Option<G::NodeId>

Gets the matched counterpart of given node, if there is any.

Returns None if the node is not matched or does not exist.

source

pub fn edges(&self) -> MatchedEdges<'_, G>

Iterates over all edges from the matching.

An edge is represented by its endpoints. The graph is considered undirected and every pair of matched nodes is reported only once.

source

pub fn nodes(&self) -> MatchedNodes<'_, G>

Iterates over all nodes from the matching.

source

pub fn contains_edge(&self, a: G::NodeId, b: G::NodeId) -> bool

Returns true if given edge is in the matching, or false otherwise.

If any of the nodes does not exist, false is returned.

source

pub fn contains_node(&self, node: G::NodeId) -> bool

Returns true if given node is in the matching, or false otherwise.

If the node does not exist, false is returned.

source

pub fn len(&self) -> usize

Gets the number of matched edges.

source

pub fn is_empty(&self) -> bool

Returns true if the number of matched edges is 0.

source§

impl<G> Matching<G>where G: NodeCount,

source

pub fn is_perfect(&self) -> bool

Returns true if the matching is perfect.

A matching is perfect if every node in the graph is incident to an edge from the matching.

Auto Trait Implementations§

§

impl<G> RefUnwindSafe for Matching<G>where G: RefUnwindSafe, <G as GraphBase>::NodeId: RefUnwindSafe,

§

impl<G> Send for Matching<G>where G: Send, <G as GraphBase>::NodeId: Send,

§

impl<G> Sync for Matching<G>where G: Sync, <G as GraphBase>::NodeId: Sync,

§

impl<G> Unpin for Matching<G>where G: Unpin, <G as GraphBase>::NodeId: Unpin,

§

impl<G> UnwindSafe for Matching<G>where G: UnwindSafe, <G as GraphBase>::NodeId: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.