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

A complete bipartite graph on a given number of nodes. More...

Inheritance diagram for Satsuma.CompleteBipartiteGraph:
Satsuma.IGraph Satsuma.IArcLookup

Public Types

enum  Color { Red, Blue }
 The color of a node. More...
 

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)
 
 CompleteBipartiteGraph (int redNodeCount, int blueNodeCount, Directedness directedness)
 Creates a complete bipartite graph. More...
 
Arc GetArc (Node u, Node v)
 Gets the unique arc between two nodes. More...
 
Node GetBlueNode (int index)
 Gets a blue node by its index. More...
 
Node GetRedNode (int index)
 Gets a red node by its index. 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...
 
bool IsRed (Node node)
 
int NodeCount ()
 Returns the total number of nodes in O(1) time. More...
 
IEnumerable< NodeNodes (Color color)
 Gets all nodes of a given color. More...
 
IEnumerable< NodeNodes ()
 Returns all nodes of the graph. More...
 
Node U (Arc arc)
 Returns the red node of an arc. More...
 
Node V (Arc arc)
 Returns the blue node of an arc. More...
 

Properties

int BlueNodeCount [get, set]
 The count of nodes in the second color class. More...
 
bool Directed [get, set]
 true if the graph is directed from red to blue nodes, false if it is undirected. More...
 
int RedNodeCount [get, set]
 The count of nodes in the first color class. More...
 

Detailed Description

A complete bipartite graph on a given number of nodes.

The two color classes of the bipartite graph are referred to as red and blue nodes. The graph may be either directed (from the red to the blue nodes) or undirected.

Memory usage: O(1).

This type is thread safe.

See Also
CompleteGraph

Definition at line 38 of file CompleteBipartiteGraph.cs.

Member Enumeration Documentation

The color of a node.

Enumerator
Red 
Blue 

Definition at line 41 of file CompleteBipartiteGraph.cs.

Constructor & Destructor Documentation

Satsuma.CompleteBipartiteGraph.CompleteBipartiteGraph ( int  redNodeCount,
int  blueNodeCount,
Directedness  directedness 
)

Creates a complete bipartite graph.

Parameters
directednessIf Directedness.Directed, then the graph is directed from the red to the blue nodes. Otherwise, the graph is undirected.

Definition at line 58 of file CompleteBipartiteGraph.cs.

Member Function Documentation

int Satsuma.CompleteBipartiteGraph.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 192 of file CompleteBipartiteGraph.cs.

int Satsuma.CompleteBipartiteGraph.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 198 of file CompleteBipartiteGraph.cs.

int Satsuma.CompleteBipartiteGraph.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 208 of file CompleteBipartiteGraph.cs.

IEnumerable<Arc> Satsuma.CompleteBipartiteGraph.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 153 of file CompleteBipartiteGraph.cs.

IEnumerable<Arc> Satsuma.CompleteBipartiteGraph.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 162 of file CompleteBipartiteGraph.cs.

IEnumerable<Arc> Satsuma.CompleteBipartiteGraph.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 181 of file CompleteBipartiteGraph.cs.

Arc Satsuma.CompleteBipartiteGraph.GetArc ( Node  u,
Node  v 
)

Gets the unique arc between two nodes.

Parameters
uThe first node.
vThe second node.
Returns
The arc whose two ends are u and v, or Arc.Invalid if the two nodes are of the same color.

Definition at line 94 of file CompleteBipartiteGraph.cs.

Node Satsuma.CompleteBipartiteGraph.GetBlueNode ( int  index)

Gets a blue node by its index.

Parameters
indexAn integer between 0 (inclusive) and BlueNodeCount (exclusive).

Definition at line 80 of file CompleteBipartiteGraph.cs.

Node Satsuma.CompleteBipartiteGraph.GetRedNode ( int  index)

Gets a red node by its index.

Parameters
indexAn integer between 0 (inclusive) and RedNodeCount (exclusive).

Definition at line 73 of file CompleteBipartiteGraph.cs.

bool Satsuma.CompleteBipartiteGraph.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 219 of file CompleteBipartiteGraph.cs.

bool Satsuma.CompleteBipartiteGraph.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 214 of file CompleteBipartiteGraph.cs.

bool Satsuma.CompleteBipartiteGraph.IsEdge ( Arc  arc)

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

Implements Satsuma.IArcLookup.

Definition at line 123 of file CompleteBipartiteGraph.cs.

bool Satsuma.CompleteBipartiteGraph.IsRed ( Node  node)

Definition at line 85 of file CompleteBipartiteGraph.cs.

int Satsuma.CompleteBipartiteGraph.NodeCount ( )

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

Implements Satsuma.IGraph.

Definition at line 187 of file CompleteBipartiteGraph.cs.

IEnumerable<Node> Satsuma.CompleteBipartiteGraph.Nodes ( Color  color)

Gets all nodes of a given color.

Definition at line 129 of file CompleteBipartiteGraph.cs.

IEnumerable<Node> Satsuma.CompleteBipartiteGraph.Nodes ( )

Returns all nodes of the graph.

Implements Satsuma.IGraph.

Definition at line 145 of file CompleteBipartiteGraph.cs.

Node Satsuma.CompleteBipartiteGraph.U ( Arc  arc)

Returns the red node of an arc.

Implements Satsuma.IArcLookup.

Definition at line 112 of file CompleteBipartiteGraph.cs.

Node Satsuma.CompleteBipartiteGraph.V ( Arc  arc)

Returns the blue node of an arc.

Implements Satsuma.IArcLookup.

Definition at line 118 of file CompleteBipartiteGraph.cs.

Property Documentation

int Satsuma.CompleteBipartiteGraph.BlueNodeCount
getset

The count of nodes in the second color class.

Definition at line 50 of file CompleteBipartiteGraph.cs.

bool Satsuma.CompleteBipartiteGraph.Directed
getset

true if the graph is directed from red to blue nodes, false if it is undirected.

Definition at line 53 of file CompleteBipartiteGraph.cs.

int Satsuma.CompleteBipartiteGraph.RedNodeCount
getset

The count of nodes in the first color class.

Definition at line 48 of file CompleteBipartiteGraph.cs.


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