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.CompleteGraph Class Reference

A complete undirected or directed graph on a given number of nodes. More...

Inheritance diagram for Satsuma.CompleteGraph:
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)
 
 CompleteGraph (int nodeCount, Directedness directedness)
 
Arc GetArc (Node u, Node v)
 Gets the unique arc between two nodes. More...
 
Node GetNode (int index)
 Gets a node of the complete graph by its index. More...
 
int GetNodeIndex (Node node)
 Gets the index of a graph node. 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...
 
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

bool Directed [get, set]
 true if the graph contains all the possible directed arcs, false if it contains all the possible edges. More...
 

Detailed Description

A complete undirected or directed graph on a given number of nodes.

A complete undirected graph is defined as a graph which has all the possible edges. A complete directed graph is defined as a graph which has all the possible directed arcs.

Memory usage: O(1).

This type is thread safe.

See Also
CompleteBipartiteGraph

Definition at line 38 of file CompleteGraph.cs.

Constructor & Destructor Documentation

Satsuma.CompleteGraph.CompleteGraph ( int  nodeCount,
Directedness  directedness 
)

Definition at line 46 of file CompleteGraph.cs.

Member Function Documentation

int Satsuma.CompleteGraph.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 162 of file CompleteGraph.cs.

int Satsuma.CompleteGraph.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 169 of file CompleteGraph.cs.

int Satsuma.CompleteGraph.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 180 of file CompleteGraph.cs.

IEnumerable<Arc> Satsuma.CompleteGraph.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 117 of file CompleteGraph.cs.

IEnumerable<Arc> Satsuma.CompleteGraph.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 133 of file CompleteGraph.cs.

IEnumerable<Arc> Satsuma.CompleteGraph.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 147 of file CompleteGraph.cs.

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

Gets the unique arc between two nodes.

Parameters
uThe first node.
vThe second node.
Returns
The arc that goes from u to v, or Arc.Invalid if u equals v.

Definition at line 76 of file CompleteGraph.cs.

Node Satsuma.CompleteGraph.GetNode ( int  index)

Gets a node of the complete graph by its index.

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

Definition at line 60 of file CompleteGraph.cs.

int Satsuma.CompleteGraph.GetNodeIndex ( Node  node)

Gets the index of a graph node.

Returns
An integer between 0 (inclusive) and NodeCount() (exclusive).

Definition at line 67 of file CompleteGraph.cs.

bool Satsuma.CompleteGraph.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 196 of file CompleteGraph.cs.

bool Satsuma.CompleteGraph.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 191 of file CompleteGraph.cs.

bool Satsuma.CompleteGraph.IsEdge ( Arc  arc)

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

Implements Satsuma.IArcLookup.

Definition at line 106 of file CompleteGraph.cs.

int Satsuma.CompleteGraph.NodeCount ( )

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

Implements Satsuma.IGraph.

Definition at line 157 of file CompleteGraph.cs.

IEnumerable<Node> Satsuma.CompleteGraph.Nodes ( )

Returns all nodes of the graph.

Implements Satsuma.IGraph.

Definition at line 111 of file CompleteGraph.cs.

Node Satsuma.CompleteGraph.U ( Arc  arc)

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

Implements Satsuma.IArcLookup.

Definition at line 96 of file CompleteGraph.cs.

Node Satsuma.CompleteGraph.V ( Arc  arc)

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

Implements Satsuma.IArcLookup.

Definition at line 101 of file CompleteGraph.cs.

Property Documentation

bool Satsuma.CompleteGraph.Directed
getset

true if the graph contains all the possible directed arcs, false if it contains all the possible edges.

Definition at line 42 of file CompleteGraph.cs.


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