Satsuma
a delicious .NET graph library
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Pages
Public Member Functions | Properties | List of all members
Satsuma.Matching Class Reference

Adaptor for storing a matching of an underlying graph. More...

Inheritance diagram for Satsuma.Matching:
Satsuma.IMatching Satsuma.IClearable Satsuma.IGraph Satsuma.IArcLookup

Public Member Functions

int ArcCount (ArcFilter filter=ArcFilter.All)
 Returns the total number of arcs satisfying a given filter. More...
 
int ArcCount (Node u, ArcFilter filter=ArcFilter.All)
 Returns the number of arcs adjacent to a specific node satisfying a given filter. More...
 
int ArcCount (Node u, Node v, ArcFilter filter=ArcFilter.All)
 Returns the number of arcs adjacent to two nodes satisfying a given filter. More...
 
IEnumerable< ArcArcs (ArcFilter filter=ArcFilter.All)
 
IEnumerable< ArcArcs (Node u, ArcFilter filter=ArcFilter.All)
 
IEnumerable< ArcArcs (Node u, Node v, ArcFilter filter=ArcFilter.All)
 
void Clear ()
 Reverts the object to its default state. More...
 
void Enable (Arc arc, bool enabled)
 Enables/disables an arc (adds/removes it from the matching). More...
 
bool HasArc (Arc arc)
 Returns whether the given arc is contained in the graph. More...
 
bool HasNode (Node node)
 Returns whether the given node is contained in the graph. More...
 
bool IsEdge (Arc arc)
 Returns whether the arc is undirected (true) or directed (false). More...
 
Arc MatchedArc (Node node)
 Gets the matching arc which contains the given node. More...
 
 Matching (IGraph graph)
 
int NodeCount ()
 Returns the total number of nodes in O(1) time. More...
 
IEnumerable< NodeNodes ()
 Returns all nodes of the graph. More...
 
Node U (Arc arc)
 Returns the first node of an arc. Directed arcs point from U to V. More...
 
Node V (Arc arc)
 Returns the second node of an arc. Directed arcs point from U to V. More...
 

Properties

IGraph Graph [get, set]
 

Detailed Description

Adaptor for storing a matching of an underlying graph.

The Node and Arc set of the adaptor is a subset of that of the original graph. The underlying graph can be modified while using this adaptor, as long as no matched nodes and matching arcs are deleted.

Definition at line 29 of file Matching.cs.

Constructor & Destructor Documentation

Satsuma.Matching.Matching ( IGraph  graph)

Definition at line 37 of file Matching.cs.

Member Function Documentation

int Satsuma.Matching.ArcCount ( ArcFilter  filter = ArcFilter.All)

Returns the total number of arcs satisfying a given filter.

Parameters
filterDetailed description: see Arcs(ArcFilter).

Implements Satsuma.IGraph.

Definition at line 145 of file Matching.cs.

int Satsuma.Matching.ArcCount ( Node  u,
ArcFilter  filter = ArcFilter.All 
)

Returns the number of arcs adjacent to a specific node satisfying a given filter.

Parameters
filterDetailed description: see Arcs(Node, ArcFilter).

Implements Satsuma.IGraph.

Definition at line 150 of file Matching.cs.

int Satsuma.Matching.ArcCount ( Node  u,
Node  v,
ArcFilter  filter = ArcFilter.All 
)

Returns the number of arcs adjacent to two nodes satisfying a given filter.

Parameters
filterDetailed description: see Arcs(Node, Node, ArcFilter).

Implements Satsuma.IGraph.

Definition at line 156 of file Matching.cs.

IEnumerable<Arc> Satsuma.Matching.Arcs ( ArcFilter  filter = ArcFilter.All)

Returns all arcs of the graph satisfying a given filter.

Parameters
filterCannot be ArcType.Forward/ArcType.Backward.
  • If ArcFilter.All, then all arcs are returned.
  • If ArcFilter.Edge, only the edges (undirected arcs) are returned.

Implements Satsuma.IGraph.

Definition at line 110 of file Matching.cs.

IEnumerable<Arc> Satsuma.Matching.Arcs ( Node  u,
ArcFilter  filter = ArcFilter.All 
)

Returns all arcs adjacent to a specific node satisfying a given filter.

Parameters
filter
  • If ArcFilter.All, then all arcs are returned.
  • If ArcFilter.Edge, only the edges (undirected arcs) are returned.
  • If ArcFilter.Forward, only the arcs exiting u (this includes edges) are returned.
  • If ArcFilter.Backward, only the arcs entering u (this includes edges) are returned.

Implements Satsuma.IGraph.

Definition at line 125 of file Matching.cs.

IEnumerable<Arc> Satsuma.Matching.Arcs ( Node  u,
Node  v,
ArcFilter  filter = ArcFilter.All 
)

Returns all arcs adjacent to two nodes satisfying a given filter.

Parameters
filter
  • If ArcFilter.All, then all arcs are returned.
  • If ArcFilter.Edge, only the edges (undirected arcs) are returned.
  • If ArcFilter.Forward, only the arcs from u to v (this includes edges) are returned.
  • If ArcFilter.Backward, only the arcs from v to u (this includes edges) are returned.

Implements Satsuma.IGraph.

Definition at line 131 of file Matching.cs.

void Satsuma.Matching.Clear ( )

Reverts the object to its default state.

Implements Satsuma.IClearable.

Definition at line 47 of file Matching.cs.

void Satsuma.Matching.Enable ( Arc  arc,
bool  enabled 
)

Enables/disables an arc (adds/removes it from the matching).

If the arc is already enabled/disabled, does nothing.

Parameters
arcAn arc of Graph.
Exceptions
ArgumentExceptionTrying to enable an illegal arc.

Definition at line 58 of file Matching.cs.

bool Satsuma.Matching.HasArc ( Arc  arc)

Returns whether the given arc is contained in the graph.

Must return the same value as Arcs().Contains in all implementations, but faster if possible.

Note
true may be returned for arcs coming from another graph as well, if those arcs encapsulate an identifier which is valid for this graph, too.

Implements Satsuma.IGraph.

Definition at line 171 of file Matching.cs.

bool Satsuma.Matching.HasNode ( Node  node)

Returns whether the given node is contained in the graph.

Must return the same value as Nodes().Contains in all implementations, but faster if possible.

Note
true may be returned for nodes coming from another graph as well, if those nodes encapsulate an identifier which is valid for this graph, too.

Implements Satsuma.IGraph.

Definition at line 166 of file Matching.cs.

bool Satsuma.Matching.IsEdge ( Arc  arc)

Returns whether the arc is undirected (true) or directed (false).

Implements Satsuma.IArcLookup.

Definition at line 100 of file Matching.cs.

Arc Satsuma.Matching.MatchedArc ( Node  node)

Gets the matching arc which contains the given node.

Equivalent to Arcs(node).FirstOrDefault(), but should be faster.

Parameters
nodeA node of Graph.
Returns
The arc which matches the given node, or Arc.Invalid if the node is unmatched.

Implements Satsuma.IMatching.

Definition at line 84 of file Matching.cs.

int Satsuma.Matching.NodeCount ( )

Returns the total number of nodes in O(1) time.

Implements Satsuma.IGraph.

Definition at line 140 of file Matching.cs.

IEnumerable<Node> Satsuma.Matching.Nodes ( )

Returns all nodes of the graph.

Implements Satsuma.IGraph.

Definition at line 105 of file Matching.cs.

Node Satsuma.Matching.U ( Arc  arc)

Returns the first node of an arc. Directed arcs point from U to V.

Implements Satsuma.IArcLookup.

Definition at line 90 of file Matching.cs.

Node Satsuma.Matching.V ( Arc  arc)

Returns the second node of an arc. Directed arcs point from U to V.

Implements Satsuma.IArcLookup.

Definition at line 95 of file Matching.cs.

Property Documentation

IGraph Satsuma.Matching.Graph
getset

Definition at line 31 of file Matching.cs.


The documentation for this class was generated from the following file: