Show / Hide Table of Contents

Class GraphSetOmnitree<T, TEquate, THash>

Stores the graph as a set-hash of nodes and quadtree of edges.

Inheritance
System.Object
GraphSetOmnitree<T, TEquate, THash>
Implements
IGraph<T>
IDataStructure<T>
ISteppable<T>
System.Collections.Generic.IEnumerable<T>
DataStructure.IAddable<T>
DataStructure.IRemovable<T>
DataStructure.IClearable
ICloneable<GraphSetOmnitree<T, TEquate, THash>>
DataStructure.IEquating<T, TEquate>
DataStructure.IHashing<T, THash>
Namespace: Towel.DataStructures
Assembly: Towel.dll
Syntax
public class GraphSetOmnitree<T, TEquate, THash> : object, IGraph<T>, IDataStructure<T>, ISteppable<T>, System.Collections.Generic.IEnumerable<T>, DataStructure.IAddable<T>, DataStructure.IRemovable<T>, DataStructure.IClearable, ICloneable<GraphSetOmnitree<T, TEquate, THash>>, DataStructure.IEquating<T, TEquate>, DataStructure.IHashing<T, THash> where TEquate : struct, IFunc<T, T, bool> where THash : struct, IFunc<T, int>
Type Parameters
Name Description
T

The generic type of this data structure.

TEquate

The type of function for quality checking T values.

THash

The type of function for hashing T values.

Constructors

| Improve this Doc View Source

GraphSetOmnitree(TEquate, THash, Nullable<Func<T, T, CompareResult>>)

Constructs a new GraphSetOmnitree.

Declaration
public GraphSetOmnitree(TEquate equate = default(TEquate), THash hash = default(THash), Func<T, T, CompareResult>? compare = null)
Parameters
Type Name Description
TEquate equate

The equate delegate for the data structure to use.

THash hash

The hash delegate for the datastructure to use.

System.Nullable<Func<T, T, CompareResult>> compare

The compare delegate for the data structure to use.

Properties

| Improve this Doc View Source

EdgeCount

The number of edges in the graph.

Declaration
public int EdgeCount { get; }
Property Value
Type Description
System.Int32
| Improve this Doc View Source

Equate

Gets the value of the type that is checking T values for equality.

Declaration
public TEquate Equate { get; }
Property Value
Type Description
TEquate
| Improve this Doc View Source

Hash

Gets the value of the type that is hashing T values.

Declaration
public THash Hash { get; }
Property Value
Type Description
THash
| Improve this Doc View Source

NodeCount

The number of nodes in the graph.

Declaration
public int NodeCount { get; }
Property Value
Type Description
System.Int32

Methods

| Improve this Doc View Source

Adjacent(T, T)

Checks if an edge exists from a to b.

Declaration
public bool Adjacent(T a, T b)
Parameters
Type Name Description
T a

The start of the edge.

T b

The end of the edge.

Returns
Type Description
System.Boolean

True if an edge exists from a to b; False if not

| Improve this Doc View Source

Clear()

Returns the data structure to an empty state.

Declaration
public void Clear()
| Improve this Doc View Source

Clone()

Clones a T.

Declaration
public GraphSetOmnitree<T, TEquate, THash> Clone()
Returns
Type Description
GraphSetOmnitree<T, TEquate, THash>

A clone of the T.

| Improve this Doc View Source

EdgesBreak<TStep>(TStep)

Invokes a function on every edge in the graph.

Declaration
public StepStatus EdgesBreak<TStep>(TStep step = default(TStep))
    where TStep : struct, IFunc<(T, T), StepStatus>
Parameters
Type Name Description
TStep step

The function to perform on every edge in the graph.

Returns
Type Description
StepStatus

The status of the traversal.

Type Parameters
Name Description
TStep

The type of the step function.

| Improve this Doc View Source

GetEnumerator()

Declaration
public System.Collections.Generic.IEnumerator<T> GetEnumerator()
Returns
Type Description
System.Collections.Generic.IEnumerator<T>
| Improve this Doc View Source

GetNeighbours(T)

Gets enumerator of all neighbours of a node

Declaration
public System.Collections.Generic.IEnumerable<T> GetNeighbours(T node)
Parameters
Type Name Description
T node

The node to get neighbours of

Returns
Type Description
System.Collections.Generic.IEnumerable<T>

IEnumerable of all neighbours of the given node

| Improve this Doc View Source

Neighbors(T, Action<T>)

Gets all the nodes adjacent to a and performs the provided delegate on each.

Declaration
public void Neighbors(T node, Action<T> step)
Parameters
Type Name Description
T node
Action<T> step
| Improve this Doc View Source

StepperBreak<TStep>(TStep)

Traverses values and invokes a function on every T value.

Declaration
public StepStatus StepperBreak<TStep>(TStep step = default(TStep))
    where TStep : struct, IFunc<T, StepStatus>
Parameters
Type Name Description
TStep step

The function to invoke on every T value.

Returns
Type Description
StepStatus

The status of the traversal.

Type Parameters
Name Description
TStep

The type of function to invoke on every T value.

| Improve this Doc View Source

ToArray()

Constructs an array with the values of this data structure.

Declaration
public T[] ToArray()
Returns
Type Description
T[]

An array with the values of this data structure.

| Improve this Doc View Source

TryAdd(T)

Tries to add a value to a data structure.

Declaration
public (bool Success, Exception? Exception) TryAdd(T node)
Parameters
Type Name Description
T node
Returns
Type Description
System.ValueTuple<System.Boolean, System.Nullable<Exception>>

True if the value was added or false if not.

| Improve this Doc View Source

TryAdd(T, T)

Adds an edge to the graph starting at a and ending at b.

Declaration
public (bool Success, Exception? Exception) TryAdd(T start, T end)
Parameters
Type Name Description
T start

The stating point of the edge to add.

T end

The ending point of the edge to add.

Returns
Type Description
System.ValueTuple<System.Boolean, System.Nullable<Exception>>
  • Success: true if the edge was added or false if not
  • ? Exception: the exception that occured if the add failed
| Improve this Doc View Source

TryRemove(T)

Tries to remove a value.

Declaration
public (bool Success, Exception? Exception) TryRemove(T node)
Parameters
Type Name Description
T node
Returns
Type Description
System.ValueTuple<System.Boolean, System.Nullable<Exception>>

True if the value was removed or false if not.

| Improve this Doc View Source

TryRemove(T, T)

Removes an edge from the graph.

Declaration
public (bool Success, Exception? Exception) TryRemove(T start, T end)
Parameters
Type Name Description
T start

The starting point of the edge to remove.

T end

The ending point of the edge to remove.

Returns
Type Description
System.ValueTuple<System.Boolean, System.Nullable<Exception>>
  • Success: true if the edge was removed or false if not
  • ? Exception: the exception that occured if the remove failed

Implements

IGraph<T>
IDataStructure<T>
ISteppable<T>
System.Collections.Generic.IEnumerable<>
DataStructure.IAddable<T>
DataStructure.IRemovable<T>
DataStructure.IClearable
ICloneable<T>
DataStructure.IEquating<T, TEquate>
DataStructure.IHashing<T, THash>
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX