Show / Hide Table of Contents

Interface IGraphWeighted<T, TWeight>

A weighted graph data structure that stores nodes, edges with their corresponding weights.

Inherited Members
IGraph<T>.EdgeCount
IGraph<T>.NodeCount
IGraph<T>.Adjacent(T, T)
IGraph<T>.Neighbors(T, Action<T>)
IGraph<T>.GetNeighbours(T)
IGraph<T>.TryAdd(T, T)
IGraph<T>.TryRemove(T, T)
IGraph<T>.EdgesBreak<TStep>(TStep)
IDataStructure<T>.ToArray()
ISteppable<T>.StepperBreak<TStep>(TStep)
DataStructure.IAddable<T>.TryAdd(T)
DataStructure.IRemovable<T>.TryRemove(T)
DataStructure.IClearable.Clear()
Namespace: Towel.DataStructures
Assembly: Towel.dll
Syntax
public interface IGraphWeighted<T, TWeight> : IGraph<T>, IDataStructure<T>, ISteppable<T>, System.Collections.Generic.IEnumerable<T>, DataStructure.IAddable<T>, DataStructure.IRemovable<T>, DataStructure.IClearable
Type Parameters
Name Description
T

The generic node type of this graph.

TWeight

The generic weight type of this graph.

Methods

| Improve this Doc View Source

Adjacent(T, T, out TWeight)

Checks if b is adjacent to a.

Declaration
bool Adjacent(T a, T b, out TWeight weight)
Parameters
Type Name Description
T a

The starting point of the edge to check.

T b

The ending point of the edge to check.

TWeight weight

The weight of the edge, if it exists.

Returns
Type Description
System.Boolean

True if b is adjacent to a; False if not

| Improve this Doc View Source

EdgesAndWeightsToArray()

Enumerates and returns all edges present in the graph

Declaration
(T, T, TWeight)[] EdgesAndWeightsToArray()
Returns
Type Description
System.ValueTuple<T, T, TWeight>[]

Array of Tuple of nodes and weight that represent an edge

| Improve this Doc View Source

EdgesToArray()

Enumerates and returns all edges present in the graph

Declaration
(T, T)[] EdgesToArray()
Returns
Type Description
System.ValueTuple<T, T>[]

Array of Tuple of nodes that represent an edge

| Improve this Doc View Source

GetWeight(T, T)

Gets the weight of an edge.

Declaration
TWeight GetWeight(T a, T b)
Parameters
Type Name Description
T a

The starting node of the edge.

T b

The ending node of the edge.

Returns
Type Description
TWeight

The weight of the edge.

| Improve this Doc View Source

TryAdd(T, T, TWeight)

Adds a weighted edge to the graph

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

The starting point of the edge to add

T end

The ending point of the edge to add

TWeight weight

The weight of the edge

Returns
Type Description
System.ValueTuple<System.Boolean, System.Nullable<Exception>>

( Success, ? Exception)

  • Success: true if the value was added or false
  • ? Exception: the exception that occured if the add was not successful

Explicit Interface Implementations

| Improve this Doc View Source

IGraph<T>.TryAdd(T, T)

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

Extension Methods

Steppable.Stepper<T>(ISteppable<T>, Action<T>)
Steppable.Stepper<T, TStep>(ISteppable<T>, TStep)
Steppable.StepperBreak<T>(ISteppable<T>, Func<T, StepStatus>)
DataStructure.Add<T>(DataStructure.IAddable<T>, T)
DataStructure.Remove<T>(DataStructure.IRemovable<T>, T)
Graph.Add<T>(IGraph<T>, T, T)
Graph.Remove<T>(IGraph<T>, T)
Graph.Remove<T>(IGraph<T>, T, T)
Graph.Edges<T>(IGraph<T>, Action<(T, T)>)
Graph.Edges<T, TStep>(IGraph<T>, TStep)
Graph.EdgesBreak<T>(IGraph<T>, Func<(T, T), StepStatus>)
GraphWeighted.Add<T, TWeight>(IGraphWeighted<T, TWeight>, T, T, TWeight)
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX