ShortestPathResult<TVertex> Struct
Definition
- Namespace
- Bodu.Collections.Generic.Graphs
- Assembly
- Bodu.Collections.dll
- Package
- Bodu.Collections 1.0.0
- Source
- ShortestPathResult{T}.cs
Represents the outcome of a shortest-path search: whether the target was reachable, the total distance, and the reconstructed path.
public readonly struct ShortestPathResult<TVertex> : IEquatable<ShortestPathResult<TVertex>> where TVertex : notnull
Type Parameters
TVertexThe vertex type.
- Implements
-
IEquatable<ShortestPathResult<TVertex>>
- Inherited Members
- Extension Methods
Constructors
ShortestPathResult(bool, double, IReadOnlyList<TVertex>)
Represents the outcome of a shortest-path search: whether the target was reachable, the total distance, and the reconstructed path.
public ShortestPathResult(bool Found, double Distance, IReadOnlyList<TVertex> Path)
Parameters
FoundboolDistancedoubleThe total weight of the path when
Foundis true; otherwise, PositiveInfinity.PathIReadOnlyList<TVertex>The vertices of the path from source to target inclusive when
Foundis true; otherwise, an empty list.
Properties
Distance
The total weight of the path when Found is true; otherwise,
PositiveInfinity.
public double Distance { get; init; }
Property Value
Found
public bool Found { get; init; }
Property Value
Path
The vertices of the path from source to target inclusive when Found is true;
otherwise, an empty list.
public IReadOnlyList<TVertex> Path { get; init; }
Property Value
- IReadOnlyList<TVertex>
Methods
Deconstruct(out bool, out double, out IReadOnlyList<TVertex>)
public void Deconstruct(out bool Found, out double Distance, out IReadOnlyList<TVertex> Path)
Parameters
FoundboolDistancedoublePathIReadOnlyList<TVertex>
Equals(ShortestPathResult<TVertex>)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(ShortestPathResult<TVertex> other)
Parameters
otherShortestPathResult<TVertex>An object to compare with this object.
Returns
Equals(object)
Indicates whether this instance and a specified object are equal.
public override bool Equals(object obj)
Parameters
objobjectThe object to compare with the current instance.
Returns
GetHashCode()
Returns the hash code for this instance.
public override int GetHashCode()
Returns
- int
A 32-bit signed integer that is the hash code for this instance.
ToString()
Returns the fully qualified type name of this instance.
public override string ToString()
Returns
- string
The fully qualified type name.
Operators
operator ==(ShortestPathResult<TVertex>, ShortestPathResult<TVertex>)
public static bool operator ==(ShortestPathResult<TVertex> left, ShortestPathResult<TVertex> right)
Parameters
leftShortestPathResult<TVertex>rightShortestPathResult<TVertex>
Returns
operator !=(ShortestPathResult<TVertex>, ShortestPathResult<TVertex>)
public static bool operator !=(ShortestPathResult<TVertex> left, ShortestPathResult<TVertex> right)
Parameters
leftShortestPathResult<TVertex>rightShortestPathResult<TVertex>
Returns
Applies to
| Product | Versions |
|---|---|
| .NET | 8, 10 |