Class DirectedPath<TWeight>
- Namespace
- AlgorithmsSW.EdgeWeightedDigraph
- Assembly
- AlgorithmsSW.dll
public record DirectedPath<TWeight> : IEquatable<DirectedPath<TWeight>> where TWeight : INumber<TWeight>
Type Parameters
TWeight
- Inheritance
-
DirectedPath<TWeight>
- Implements
-
IEquatable<DirectedPath<TWeight>>
- Inherited Members
- Extension Methods
Constructors
DirectedPath(DirectedEdge<TWeight>)
Initializes a new instance of the DirectedPath<TWeight> class with a single edge.
public DirectedPath(DirectedEdge<TWeight> edge)
Parameters
edge
DirectedEdge<TWeight>The edge to initialize the path with.
DirectedPath(ResizeableArray<DirectedEdge<TWeight>>)
Initializes a new instance of the DirectedPath<TWeight> class from a list of edges.
public DirectedPath(ResizeableArray<DirectedEdge<TWeight>> edges)
Parameters
edges
ResizeableArray<DirectedEdge<TWeight>>The edges to initialize the path with.
DirectedPath(ResizeableArray<DirectedEdge<TWeight>>, TWeight)
public DirectedPath(ResizeableArray<DirectedEdge<TWeight>> edges, TWeight distance)
Parameters
edges
ResizeableArray<DirectedEdge<TWeight>>distance
TWeight
DirectedPath(int)
public DirectedPath(int singleVertex)
Parameters
singleVertex
int
Properties
Distance
public TWeight Distance { get; }
Property Value
- TWeight
Edges
public ResizeableArray<DirectedEdge<TWeight>> Edges { get; }
Property Value
- ResizeableArray<DirectedEdge<TWeight>>
SourceVertex
public int SourceVertex { get; }
Property Value
TargetVertex
public int TargetVertex { get; }
Property Value
Vertexes
public IRandomAccessList<int> Vertexes { get; }
Property Value
WeightlessEdges
public IEnumerable<(int, int)> WeightlessEdges { get; }
Property Value
- IEnumerable<(int source, int target)>
Methods
Combine(DirectedEdge<TWeight>)
Combines this path with an edge.
public DirectedPath<TWeight> Combine(DirectedEdge<TWeight> edge)
Parameters
edge
DirectedEdge<TWeight>The edge to combine with this path. The Source of the edge must equal the TargetVertex of this path.
Returns
- DirectedPath<TWeight>
A new path that is the combination of this path and the edge.
Remarks
This path is not modified.
Exceptions
- ArgumentException
The target vertex of this path is not the source vertex of the edge.
Combine(DirectedPath<TWeight>)
Combines two paths into one.
public DirectedPath<TWeight> Combine(DirectedPath<TWeight> other)
Parameters
other
DirectedPath<TWeight>The path to combine with this path. The TargetVertex of this path must equal the SourceVertex of the other path.
Returns
- DirectedPath<TWeight>
A new path that is the combination of this path and the other path.
Remarks
This path is not modified.
Exceptions
- ArgumentException
The target vertex of this path is not the source vertex of the other path.
HasEqualVertices(DirectedPath<TWeight>)
public bool HasEqualVertices(DirectedPath<TWeight> other)
Parameters
other
DirectedPath<TWeight>
Returns
Skip(int)
public DirectedPath<TWeight> Skip(int count)
Parameters
count
int
Returns
- DirectedPath<TWeight>
Take(int)
public DirectedPath<TWeight> Take(int count)
Parameters
count
int
Returns
- DirectedPath<TWeight>
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.