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

Adaptor for hiding/showing nodes/arcs of an underlying graph. More...

Inheritance diagram for Satsuma.Subgraph:
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)
 
void Enable (Node node, bool enabled)
 Enables/disables a single node. More...
 
void Enable (Arc arc, bool enabled)
 Enables/disables a single arc. More...
 
void EnableAllArcs (bool enabled)
 Enables/disables all arcs at once. More...
 
void EnableAllNodes (bool enabled)
 Enables/disables all nodes at once. 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 IsEnabled (Node node)
 Queries the enabledness of a node. More...
 
bool IsEnabled (Arc arc)
 Queries the enabledness of an arc. More...
 
int NodeCount ()
 Returns the total number of nodes in O(1) time. More...
 
IEnumerable< NodeNodes ()
 Returns all nodes of the graph. More...
 
 Subgraph (IGraph graph)
 
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 hiding/showing nodes/arcs of an underlying graph.

Node and Arc objects are interchangeable between the adaptor and the original graph.

The underlying graph can be modified while using this adaptor, as long as no nodes/arcs are deleted; and newly added nodes/arcs are explicitly enabled/disabled, since enabledness of newly added nodes/arcs is undefined.

By default, all nodes and arcs are enabled.

See Also
Supergraph

Definition at line 40 of file Subgraph.cs.

Constructor & Destructor Documentation

Satsuma.Subgraph.Subgraph ( IGraph  graph)

Definition at line 49 of file Subgraph.cs.

Member Function Documentation

int Satsuma.Subgraph.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 161 of file Subgraph.cs.

int Satsuma.Subgraph.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 171 of file Subgraph.cs.

int Satsuma.Subgraph.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 176 of file Subgraph.cs.

IEnumerable<Arc> Satsuma.Subgraph.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 136 of file Subgraph.cs.

IEnumerable<Arc> Satsuma.Subgraph.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 142 of file Subgraph.cs.

IEnumerable<Arc> Satsuma.Subgraph.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 149 of file Subgraph.cs.

void Satsuma.Subgraph.Enable ( Node  node,
bool  enabled 
)

Enables/disables a single node.

Parameters
enabledtrue if the node should be enabled, false if the node should be disabled.

Definition at line 75 of file Subgraph.cs.

void Satsuma.Subgraph.Enable ( Arc  arc,
bool  enabled 
)

Enables/disables a single arc.

Parameters
enabledtrue if the arc should be enabled, false if the arc should be disabled.

Definition at line 85 of file Subgraph.cs.

void Satsuma.Subgraph.EnableAllArcs ( bool  enabled)

Enables/disables all arcs at once.

Parameters
enabledtrue if all arcs should be enabled, false if all arcs should be disabled.

Definition at line 67 of file Subgraph.cs.

void Satsuma.Subgraph.EnableAllNodes ( bool  enabled)

Enables/disables all nodes at once.

Parameters
enabledtrue if all nodes should be enabled, false if all nodes should be disabled.

Definition at line 59 of file Subgraph.cs.

bool Satsuma.Subgraph.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 186 of file Subgraph.cs.

bool Satsuma.Subgraph.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 181 of file Subgraph.cs.

bool Satsuma.Subgraph.IsEdge ( Arc  arc)

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

Implements Satsuma.IArcLookup.

Definition at line 115 of file Subgraph.cs.

bool Satsuma.Subgraph.IsEnabled ( Node  node)

Queries the enabledness of a node.

Definition at line 94 of file Subgraph.cs.

bool Satsuma.Subgraph.IsEnabled ( Arc  arc)

Queries the enabledness of an arc.

Definition at line 100 of file Subgraph.cs.

int Satsuma.Subgraph.NodeCount ( )

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

Implements Satsuma.IGraph.

Definition at line 156 of file Subgraph.cs.

IEnumerable<Node> Satsuma.Subgraph.Nodes ( )

Returns all nodes of the graph.

Implements Satsuma.IGraph.

Definition at line 126 of file Subgraph.cs.

Node Satsuma.Subgraph.U ( Arc  arc)

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

Implements Satsuma.IArcLookup.

Definition at line 105 of file Subgraph.cs.

Node Satsuma.Subgraph.V ( Arc  arc)

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

Implements Satsuma.IArcLookup.

Definition at line 110 of file Subgraph.cs.


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