Table of Contents

Class TreeNodeBase

Namespace
Echo.Graphing
Assembly
Echo.dll

Provides a base contract for nodes that will be used in a tree.

public abstract class TreeNodeBase : INode
Inheritance
TreeNodeBase
Implements
Inherited Members

Properties

InDegree

Gets a value indicating the number of incoming edges that this node is incident to.

public int InDegree { get; }

Property Value

int

OutDegree

Gets a value indicating the number of outgoing edges that this node is incident to.

public int OutDegree { get; }

Property Value

int

Parent

The parent of this TreeNodeBase

public TreeNodeBase? Parent { get; }

Property Value

TreeNodeBase

Methods

GetChildren()

Gets the children of the current TreeNodeBase.

public abstract IEnumerable<TreeNodeBase> GetChildren()

Returns

IEnumerable<TreeNodeBase>

The children.

GetIncomingEdges()

Gets a collection of all edges that target this node.

public IEnumerable<IEdge> GetIncomingEdges()

Returns

IEnumerable<IEdge>

The incoming edges.

GetOutgoingEdges()

Gets a collection of all outgoing edges originating from this node.

public IEnumerable<IEdge> GetOutgoingEdges()

Returns

IEnumerable<IEdge>

The outgoing edges.

GetPredecessors()

Gets a collection of nodes that precede this node.

public IEnumerable<INode> GetPredecessors()

Returns

IEnumerable<INode>

The predecessor nodes.

GetSuccessors()

Gets a collection of nodes that can be reached from this node by following one of the incident edges.

public IEnumerable<INode> GetSuccessors()

Returns

IEnumerable<INode>

The successor nodes.

HasPredecessor(INode)

Determines whether the provided node precedes the current node.

public bool HasPredecessor(INode node)

Parameters

node INode

The node to check.

Returns

bool

True if the node is a predecessor, false otherwise.

HasSuccessor(INode)

Determines whether the provided node can be reached from this node by following one of the incident edges.

public bool HasSuccessor(INode node)

Parameters

node INode

The node to check.

Returns

bool

True if the node is a successor, false otherwise.

OnParentChanged(TreeNodeBase?)

Called when the parent of the tree node changes.

protected virtual void OnParentChanged(TreeNodeBase? old)

Parameters

old TreeNodeBase

The original tree node parent.

UpdateChildNotNull<T>(ref T, T)

Updates the value and the parent of the child node, ensuring that the new value is not null.

protected void UpdateChildNotNull<T>(ref T child, T value) where T : TreeNodeBase

Parameters

child T

The child element to update.

value T

The new value to assign to the child.

Type Parameters

T

Exceptions

ArgumentNullException

When the new node is null.

InvalidOperationException

When the node already has a parent.

UpdateChild<T>(ref T?, T?)

Updates the value and the parent of the child node.

protected void UpdateChild<T>(ref T? child, T? value) where T : TreeNodeBase

Parameters

child T

The child element to update.

value T

The new value to assign to the child.

Type Parameters

T

Exceptions

InvalidOperationException

When the node already has a parent.