TINMAN 3D / REALTIME TERRAIN
Software Development Kit - User Manual

class Graph in Tinman.Core.Collections

A directed graph (i.e. a set of nodes that are connected with directional links).

sealed class Graph with <TNode>  
  extends Disposable

Remarks

Graph nodes are represented by GraphNode objects and carry an immutable user-defined object (see Value).

Graph links are represented by GraphLink objects and carry a mutable user-defined weight value (see Weight).

Public / Attributes

LifecycleState

Returns the lifecycle state of this object.

public virtual property LifecycleState { get }
type LifecycleState
value The lifecycle state.
inherited Disposable.LifecycleState

Links

Returns the graph links.

public property Links { get }
type IBagConst<GraphLink<TNode>>
value [not-null] The set of graph links.

Nodes

Returns the graph nodes.

public property Nodes { get }
type IBagConst<GraphNode<TNode>>
value [not-null] The set of graph nodes.

SinkNodes

Returns the graph sink nodes (i.e. nodes with no outgoing links).

public property SinkNodes { get }
type IBagConst<GraphNode<TNode>>
value [not-null] The set of graph nodes.

SourceNodes

Returns the graph source nodes (i.e. nodes with no incoming links).

public property SourceNodes { get }
type IBagConst<GraphNode<TNode>>
value [not-null] The set of graph nodes.

Public / Constructors

Graph

Creates a new instance of Graph.

public constructor Graph (EqualsDelegate<TNode> equals = null)
params equals The node equality delegate.

Public / Methods

AcquireTry

Acquires a strong reference to this disposable object.

[OwnerReturn, ThreadSafe]
public method AcquireTry ()
type IDisposable
returns this if a new strong reference has been acquired, null if this object is already being disposed.
inherited Disposable.AcquireTry

Remarks:

The object will not be actually disposed by calls to Dispose when there is at least one strong reference left. Code that calls the AcquireTry method is responsible for calling the Dispose method accordingly.

This method is not intended to be used in performance-critical code. It should only be used to high-level resource management.

Clear

Removes all nodes and links from this graph.

public method Clear ()

Copy

Creates a copy of this graph.

[OwnerReturn]
public method Copy ()
type Graph<TNode>
returns [not-null] The created copy.

Dispose

Releases all resources held by this object if there are no more strong references to it, decrements the reference counter by one otherwise.

[Dispose, OwnerThis, ThreadSafe]
public method Dispose ()
inherited Disposable.Dispose

Remarks:

The Dispose method silently returns if the object has already been disposed.

Link

Adds a link to the graph.

public method Link (TNode source, TNode target)
type GraphLink<TNode>
params source The source node.
  target The target node.

Remarks:

The link will have a weight of 1.

LinkNull

Adds a link to the graph.

public method LinkNull (TNode source, TNode target)
type GraphLink<TNode>
params source The source node.
  target The target node.

Remarks:

The link will have a weight of 1.

Node

Returns the graph node for the given node value, creating it if necessary.

public method Node (TNode value)
type GraphNode<TNode>
params value The node value to add.
returns [not-null] The graph node for value.

NodeNull

Returns the graph node for the given node value.

public method NodeNull (TNode value)
type GraphNode<TNode>
params value The node value to add.
returns The graph node for value or null if no such node exists.

PopConnected

Pops all graph nodes that are directly or indirectly connected to the given node.

public method PopConnected (TNode node, CompareDelegate<TNode> sort = null)
type TNode[]
params node [not-null] The graph node to start.
  sort Optional sort order to apply.
returns [not-null] The connected nodes (including node).

PopMaximium

Pops the maximum graph nodes, regarding to the given order.

public method PopMaximium (CompareDelegate<GraphNode<TNode>> compare)
type TNode[]
params compare [not-null] The comparer that established an ordering on graph nodes.
returns [not-null] The maximum value nodes.

PopMinimum

Pops the minimum graph nodes, regarding to the given order.

public method PopMinimum (CompareDelegate<GraphNode<TNode>> compare)
type TNode[]
params compare [not-null] The comparer that established an ordering on graph nodes.
returns [not-null] The minimum value nodes.

PopNodes

Removes all nodes from the graph and returns their values as an array.

public method PopNodes (CompareDelegate<TNode> sort = null)
type TNode[]
params sort Optional sort order to apply.
returns [not-null] The array of node values.

PopSinks

Removes all sink nodes from the graph and returns their values as an array.

public method PopSinks (CompareDelegate<TNode> sort = null)
type TNode[]
params sort Optional sort order to apply.
returns [not-null] The array of sink node values.

PopSources

Removes all source nodes from the graph and returns their values as an array.

public method PopSources (CompareDelegate<TNode> sort = null)
type TNode[]
params sort Optional sort order to apply.
returns [not-null] The array of source node values.