Class TreePath<TEdge, TNode>
An immutable sequence of TNode
, where each node is child of its predecessor and parent of
its successor and where node relationships are stored in TEdge
instances.
Inheritance
Implements
Inherited Members
Namespace: MoreStructures.RecImmTrees
Assembly: MoreStructures.dll
Syntax
public class TreePath<TEdge, TNode> : IEquatable<TreePath<TEdge, TNode>> where TEdge : IRecImmDictIndexedTreeEdge<TEdge, TNode> where TNode : IRecImmDictIndexedTreeNode<TEdge, TNode>
Type Parameters
Name | Description |
---|---|
TEdge | The type of edges of the specific structure. |
TNode | The type of nodes of the specific structure. |
Remarks
Immutability is guaranteed by using ValueReadOnlyDictionary<TKey, TValue>.
Constructors
| Improve this Doc View SourceTreePath()
Builds an empty path, i.e. an empty sequence of nodes.
Declaration
public TreePath()
TreePath(TEdge, TNode)
Builds a path composed of a single node with its incoming edge.
Declaration
public TreePath(TEdge edge, TNode node)
Parameters
Type | Name | Description |
---|---|---|
TEdge | edge | The edge leading to the node. |
TNode | node | The node defining the singleton path. |
TreePath(IEnumerable<KeyValuePair<TEdge, TNode>>)
An immutable sequence of TNode
, where each node is child of its predecessor and parent of
its successor and where node relationships are stored in TEdge
instances.
Declaration
public TreePath(IEnumerable<KeyValuePair<TEdge, TNode>> PathNodes)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<KeyValuePair<TEdge, TNode>> | PathNodes | The sequence of nodes respecting the parent-child relationship. |
Remarks
Immutability is guaranteed by using ValueReadOnlyDictionary<TKey, TValue>.
TreePath((TEdge edge, TNode node)[])
Builds a path composed of the provided couples of edges and nodes.
Declaration
public TreePath(params (TEdge edge, TNode node)[] pathNodes)
Parameters
Type | Name | Description |
---|---|---|
System.ValueTuple<TEdge, TNode>[] | pathNodes | An array of couples (edge, node). |
Properties
| Improve this Doc View SourcePathNodes
A readonly view of the private collection of path TNode
instances.
Declaration
public IEnumerable<KeyValuePair<TEdge, TNode>> PathNodes { get; }
Property Value
Type | Description |
---|---|
IEnumerable<KeyValuePair<TEdge, TNode>> |
Methods
| Improve this Doc View SourceToString()
Uses a IStringifier<TEdge, TNode> to generate the string.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String |