Class Graph
Static helpers for IGraph<T>.
Inheritance
Namespace: Towel.DataStructures
Assembly: Towel.dll
Syntax
public static class Graph : object
Methods
| Improve this Doc View SourceAdd<T>(IGraph<T>, T, T)
Adds an edge to a graph.
Declaration
public static void Add<T>(this IGraph<T> graph, T a, T b)
Parameters
Type | Name | Description |
---|---|---|
IGraph<T> | graph | The data structure to add the value to. |
T | a | The start of the edge. |
T | b | The end of the edge. |
Type Parameters
Name | Description |
---|---|
T | The type of values stored in this data structure. |
Edges<T>(IGraph<T>, Action<(T, T)>)
Invokes a function on every edge in the graph.
Declaration
public static void Edges<T>(this IGraph<T> graph, Action<(T, T)> step)
Parameters
Type | Name | Description |
---|---|---|
IGraph<T> | graph | The graph to traverse the edges of. |
Action<System.ValueTuple<T, T>> | step | The function on every edge in the graph. |
Type Parameters
Name | Description |
---|---|
T | The type of values stored in this graph. |
Edges<T, TStep>(IGraph<T>, TStep)
Invokes a function on every edge in the graph.
Declaration
public static void Edges<T, TStep>(this IGraph<T> graph, TStep step = default(TStep))
where TStep : struct, IAction<(T, T)>
Parameters
Type | Name | Description |
---|---|---|
IGraph<T> | graph | The graph to traverse the edges of. |
TStep | step | The function on every edge in the graph. |
Type Parameters
Name | Description |
---|---|
T | The type of values stored in this graph. |
TStep | The type of the step function. |
EdgesBreak<T>(IGraph<T>, Func<(T, T), StepStatus>)
Invokes a function on every edge in the graph.
Declaration
public static StepStatus EdgesBreak<T>(this IGraph<T> graph, Func<(T, T), StepStatus> step)
Parameters
Type | Name | Description |
---|---|---|
IGraph<T> | graph | The graph to traverse the edges of. |
Func<System.ValueTuple<T, T>, StepStatus> | step | The function on every edge in the graph. |
Returns
Type | Description |
---|---|
StepStatus | The status of iteration. |
Type Parameters
Name | Description |
---|---|
T | The type of values stored in this graph. |
Remove<T>(IGraph<T>, T)
Removes a value from a graph.
Declaration
public static void Remove<T>(this IGraph<T> graph, T value)
Parameters
Type | Name | Description |
---|---|---|
IGraph<T> | graph | The data structure to remove the value from. |
T | value | The value to be removed. |
Type Parameters
Name | Description |
---|---|
T | The type of value. |
Remove<T>(IGraph<T>, T, T)
Removes an edge from a graph.
Declaration
public static void Remove<T>(this IGraph<T> graph, T a, T b)
Parameters
Type | Name | Description |
---|---|---|
IGraph<T> | graph | The data structure to remove the value from. |
T | a | The start of the edge. |
T | b | The end of the edge. |
Type Parameters
Name | Description |
---|---|
T | The type of values stored in this data structure. |