Struct WeightedEdge<TVertex, TWeight>
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
TVertexThe vertex type.
TWeightThe 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
sourceTVertexThe vertex the edge starts at.
targetTVertexThe vertex the edge ends at.
weightTWeightThe 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
sourceTVertexThe vertex the edge starts at.
targetTVertexThe vertex the edge ends at.
weightTWeightThe 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.