Table of Contents

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

TVertex

The vertex type.

Implements
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

Found bool

true if a path to the target exists; otherwise, false.

Distance double

The total weight of the path when Found is true; otherwise, PositiveInfinity.

Path IReadOnlyList<TVertex>

The vertices of the path from source to target inclusive when Found is 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

double

Found

true if a path to the target exists; otherwise, false.

public bool Found { get; init; }

Property Value

bool

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

Found bool
Distance double
Path IReadOnlyList<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

other ShortestPathResult<TVertex>

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

Equals(object)

Indicates whether this instance and a specified object are equal.

public override bool Equals(object obj)

Parameters

obj object

The object to compare with the current instance.

Returns

bool

true if obj and this instance are the same type and represent the same value; otherwise, false.

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

left ShortestPathResult<TVertex>
right ShortestPathResult<TVertex>

Returns

bool

operator !=(ShortestPathResult<TVertex>, ShortestPathResult<TVertex>)

public static bool operator !=(ShortestPathResult<TVertex> left, ShortestPathResult<TVertex> right)

Parameters

left ShortestPathResult<TVertex>
right ShortestPathResult<TVertex>

Returns

bool

Applies to

ProductVersions
.NET8, 10