Class Edge<TWeight>
- Namespace
- AlgorithmsSW.EdgeWeightedGraph
- Assembly
- AlgorithmsSW.dll
Represents an edge in an edge-weighted graph.
public record Edge<TWeight> : IEquatable<Edge<TWeight>>
Type Parameters
TWeightThe type of weight. See Weights.
- Inheritance
-
Edge<TWeight>
- Implements
-
IEquatable<Edge<TWeight>>
- Inherited Members
- Extension Methods
Constructors
Edge(int, int, TWeight)
Represents an edge in an edge-weighted graph.
public Edge(int Vertex0, int Vertex1, TWeight Weight)
Parameters
Vertex0intOne vertex of the edge.
Vertex1intThe other vertex of the edge.
WeightTWeightThe weight of the edge.
Properties
Vertex0
One vertex of the edge.
public int Vertex0 { get; init; }
Property Value
Vertex1
The other vertex of the edge.
public int Vertex1 { get; init; }
Property Value
Weight
The weight of the edge.
public TWeight Weight { get; init; }
Property Value
- TWeight
Methods
OtherVertex(int)
Given one vertex of the edge, returns the other vertex.
public int OtherVertex(int vertex)
Parameters
vertexint
Returns
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.