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

Adaptor for modifying the direction of some arcs of an underlying graph. More...

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

Public Types

enum  Direction { Forward, Backward, Edge }
 

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)
 
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...
 
 RedirectedGraph (IGraph graph, Func< Arc, Direction > getDirection)
 Creates an adaptor over the given graph for redirecting its arcs. 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...
 

Detailed Description

Adaptor for modifying the direction of some arcs of an underlying graph.

Node and Arc objects are interchangeable between the adaptor and the original graph. The underlying graph can be freely modified while using this adaptor. For special cases, consider the UndirectedGraph and ReverseGraph classes for performance.

Definition at line 35 of file RedirectedGraph.cs.

Member Enumeration Documentation

Enumerator
Forward 

The arc should be directed from U to V.

Backward 

The arc should be directed from V to U.

Edge 

The arc should be undirected.

Definition at line 37 of file RedirectedGraph.cs.

Constructor & Destructor Documentation

Satsuma.RedirectedGraph.RedirectedGraph ( IGraph  graph,
Func< Arc, Direction getDirection 
)

Creates an adaptor over the given graph for redirecting its arcs.

Parameters
graphThe graph to redirect.
getDirectionThe function which modifies the arc directions.

Definition at line 53 of file RedirectedGraph.cs.

Member Function Documentation

int Satsuma.RedirectedGraph.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 129 of file RedirectedGraph.cs.

int Satsuma.RedirectedGraph.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 134 of file RedirectedGraph.cs.

int Satsuma.RedirectedGraph.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 139 of file RedirectedGraph.cs.

IEnumerable<Arc> Satsuma.RedirectedGraph.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 79 of file RedirectedGraph.cs.

IEnumerable<Arc> Satsuma.RedirectedGraph.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 114 of file RedirectedGraph.cs.

IEnumerable<Arc> Satsuma.RedirectedGraph.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 119 of file RedirectedGraph.cs.

bool Satsuma.RedirectedGraph.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 149 of file RedirectedGraph.cs.

bool Satsuma.RedirectedGraph.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 144 of file RedirectedGraph.cs.

bool Satsuma.RedirectedGraph.IsEdge ( Arc  arc)

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

Implements Satsuma.IArcLookup.

Definition at line 69 of file RedirectedGraph.cs.

int Satsuma.RedirectedGraph.NodeCount ( )

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

Implements Satsuma.IGraph.

Definition at line 124 of file RedirectedGraph.cs.

IEnumerable<Node> Satsuma.RedirectedGraph.Nodes ( )

Returns all nodes of the graph.

Implements Satsuma.IGraph.

Definition at line 74 of file RedirectedGraph.cs.

Node Satsuma.RedirectedGraph.U ( Arc  arc)

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

Implements Satsuma.IArcLookup.

Definition at line 59 of file RedirectedGraph.cs.

Node Satsuma.RedirectedGraph.V ( Arc  arc)

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

Implements Satsuma.IArcLookup.

Definition at line 64 of file RedirectedGraph.cs.


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