Satsuma
a delicious .NET graph library
|
A complete bipartite graph on a given number of nodes. More...
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< Arc > | Arcs (ArcFilter filter=ArcFilter.All) |
IEnumerable< Arc > | Arcs (Node u, ArcFilter filter=ArcFilter.All) |
IEnumerable< Arc > | Arcs (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< Node > | Nodes (Color color) |
Gets all nodes of a given color. More... | |
IEnumerable< Node > | Nodes () |
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... | |
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.
Definition at line 38 of file CompleteBipartiteGraph.cs.
Satsuma.CompleteBipartiteGraph.CompleteBipartiteGraph | ( | int | redNodeCount, |
int | blueNodeCount, | ||
Directedness | directedness | ||
) |
Creates a complete bipartite graph.
directedness | If 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.
int Satsuma.CompleteBipartiteGraph.ArcCount | ( | ArcFilter | filter = ArcFilter.All | ) |
Returns the total number of arcs satisfying a given filter.
filter | Detailed description: see Arcs(ArcFilter). |
Implements Satsuma.IGraph.
Definition at line 192 of file CompleteBipartiteGraph.cs.
Returns the number of arcs adjacent to a specific node satisfying a given filter.
filter | Detailed description: see Arcs(Node, ArcFilter). |
Implements Satsuma.IGraph.
Definition at line 198 of file CompleteBipartiteGraph.cs.
Returns the number of arcs adjacent to two nodes satisfying a given filter.
filter | Detailed description: see Arcs(Node, Node, ArcFilter). |
Implements Satsuma.IGraph.
Definition at line 208 of file CompleteBipartiteGraph.cs.
Returns all arcs of the graph satisfying a given filter.
filter | Cannot be ArcType.Forward/ArcType.Backward.
|
Implements Satsuma.IGraph.
Definition at line 153 of file CompleteBipartiteGraph.cs.
Returns all arcs adjacent to a specific node satisfying a given filter.
filter |
|
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.
filter |
|
Implements Satsuma.IGraph.
Definition at line 181 of file CompleteBipartiteGraph.cs.
Gets the unique arc between two nodes.
u | The first node. |
v | The second node. |
Definition at line 94 of file CompleteBipartiteGraph.cs.
Node Satsuma.CompleteBipartiteGraph.GetBlueNode | ( | int | index | ) |
Gets a blue node by its index.
index | An 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.
index | An 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.
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.
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.
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.
Returns the red node of an arc.
Implements Satsuma.IArcLookup.
Definition at line 112 of file CompleteBipartiteGraph.cs.
Returns the blue node of an arc.
Implements Satsuma.IArcLookup.
Definition at line 118 of file CompleteBipartiteGraph.cs.
|
getset |
The count of nodes in the second color class.
Definition at line 50 of file CompleteBipartiteGraph.cs.
|
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.
|
getset |
The count of nodes in the first color class.
Definition at line 48 of file CompleteBipartiteGraph.cs.