Table of Contents

Struct WeightedEdge<TVertex, TWeight>

Namespace
Graph1x.Edges
Assembly
Graph1x.dll

A weighted edge between two vertices, with value equality over the (source, target, weight) triple.

public readonly record struct WeightedEdge<TVertex, TWeight> : IWeightedEdge<TVertex, TWeight>, IEdge<TVertex>, IEquatable<WeightedEdge<TVertex, TWeight>> where TVertex : notnull where TWeight : INumber<TWeight>

Type Parameters

TVertex

The vertex type.

TWeight

The numeric weight type.

Implements
IWeightedEdge<TVertex, TWeight>
IEdge<TVertex>
IEquatable<WeightedEdge<TVertex, TWeight>>
Inherited Members

Constructors

WeightedEdge(TVertex, TVertex, TWeight)

Initializes a new weighted edge from source to target.

public WeightedEdge(TVertex source, TVertex target, TWeight weight)

Parameters

source TVertex

The vertex the edge starts at.

target TVertex

The vertex the edge ends at.

weight TWeight

The weight of the edge.

Exceptions

ArgumentNullException

Either vertex is null.

Properties

Source

Gets the vertex the edge starts at.

public TVertex Source { get; }

Property Value

TVertex

Target

Gets the vertex the edge ends at.

public TVertex Target { get; }

Property Value

TVertex

Weight

Gets the weight of the edge.

public TWeight Weight { get; }

Property Value

TWeight

Methods

Deconstruct(out TVertex, out TVertex, out TWeight)

Deconstructs the edge into its endpoints and weight.

public void Deconstruct(out TVertex source, out TVertex target, out TWeight weight)

Parameters

source TVertex

The vertex the edge starts at.

target TVertex

The vertex the edge ends at.

weight TWeight

The weight of the edge.

ToString()

Returns the fully qualified type name of this instance.

public override string ToString()

Returns

string

The fully qualified type name.