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

A path or cycle graph on a given number of nodes. More...

Inheritance diagram for Satsuma.PathGraph:
Satsuma.IPath Satsuma.IGraph Satsuma.IArcLookup

Public Types

enum  Topology { Path, Cycle }
 

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)
 
Node GetNode (int index)
 Gets a node of the path by its index. More...
 
int GetNodeIndex (Node node)
 Gets the index of a path 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...
 
Arc NextArc (Node node)
 Returns the arc connecting a node with its successor in the path. More...
 
int NodeCount ()
 Returns the total number of nodes in O(1) time. More...
 
IEnumerable< NodeNodes ()
 Returns all nodes of the graph. More...
 
 PathGraph (int nodeCount, Topology topology, Directedness directedness)
 
Arc PrevArc (Node node)
 Returns the arc connecting a node with its predecessor in the path. 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

Node FirstNode [get]
 
Node LastNode [get]
 

Detailed Description

A path or cycle graph on a given number of nodes.

Warning
Not to be confused with Path. Path is an adaptor which stores a path or cycle of some other graph, while PathGraph is a standalone graph (a "graph constant").

Memory usage: O(1).

This type is thread safe.

See Also
Path

Definition at line 296 of file Path.cs.

Member Enumeration Documentation

Enumerator
Path 

The graph is a path.

Cycle 

The graph is a cycle.

Definition at line 304 of file Path.cs.

Constructor & Destructor Documentation

Satsuma.PathGraph.PathGraph ( int  nodeCount,
Topology  topology,
Directedness  directedness 
)

Definition at line 312 of file Path.cs.

Member Function Documentation

int Satsuma.PathGraph.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 394 of file Path.cs.

int Satsuma.PathGraph.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 399 of file Path.cs.

int Satsuma.PathGraph.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 404 of file Path.cs.

IEnumerable<Arc> Satsuma.PathGraph.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 367 of file Path.cs.

IEnumerable<Arc> Satsuma.PathGraph.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 374 of file Path.cs.

IEnumerable<Arc> Satsuma.PathGraph.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 379 of file Path.cs.

Node Satsuma.PathGraph.GetNode ( int  index)

Gets a node of the path by its index.

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

Definition at line 321 of file Path.cs.

int Satsuma.PathGraph.GetNodeIndex ( Node  node)

Gets the index of a path node.

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

Definition at line 328 of file Path.cs.

bool Satsuma.PathGraph.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 414 of file Path.cs.

bool Satsuma.PathGraph.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 409 of file Path.cs.

bool Satsuma.PathGraph.IsEdge ( Arc  arc)

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

Implements Satsuma.IArcLookup.

Definition at line 356 of file Path.cs.

Arc Satsuma.PathGraph.NextArc ( Node  node)

Returns the arc connecting a node with its successor in the path.

Returns Arc.Invalid if the node is not on the path or has no successor. If the path is a cycle, then each node has a successor.

Implements Satsuma.IPath.

Definition at line 333 of file Path.cs.

int Satsuma.PathGraph.NodeCount ( )

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

Implements Satsuma.IGraph.

Definition at line 384 of file Path.cs.

IEnumerable<Node> Satsuma.PathGraph.Nodes ( )

Returns all nodes of the graph.

Implements Satsuma.IGraph.

Definition at line 361 of file Path.cs.

Arc Satsuma.PathGraph.PrevArc ( Node  node)

Returns the arc connecting a node with its predecessor in the path.

Returns Arc.Invalid if the node is not on the path or has no predecessor. If the path is a cycle, then each node has a predecessor.

Implements Satsuma.IPath.

Definition at line 339 of file Path.cs.

Node Satsuma.PathGraph.U ( Arc  arc)

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

Implements Satsuma.IArcLookup.

Definition at line 346 of file Path.cs.

Node Satsuma.PathGraph.V ( Arc  arc)

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

Implements Satsuma.IArcLookup.

Definition at line 351 of file Path.cs.

Property Documentation

Node Satsuma.PathGraph.FirstNode
get

Definition at line 301 of file Path.cs.

Node Satsuma.PathGraph.LastNode
get

Definition at line 302 of file Path.cs.


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