Table of Contents

Class Diameter<TWeight>

Namespace
AlgorithmsSW.EdgeWeightedDigraph
Assembly
AlgorithmsSW.dll

A class that finds the diameter of a directed graph.

[ExerciseReference(4, 4, 8)]
public class Diameter<TWeight> where TWeight : INumber<TWeight>, IMinMaxValue<TWeight>

Type Parameters

TWeight

The type of the edge weights.

Inheritance
Diameter<TWeight>
Inherited Members
Extension Methods

Constructors

Diameter(IReadOnlyEdgeWeightedDigraph<TWeight>)

Initializes a new instance of the Diameter<TWeight> class.

public Diameter(IReadOnlyEdgeWeightedDigraph<TWeight> graph)

Parameters

graph IReadOnlyEdgeWeightedDigraph<TWeight>

The graph to find the diameter of.

Properties

Distance

The total distance of the diameter.

public TWeight Distance { get; }

Property Value

TWeight

Path

The path of the diameter.

public IEnumerable<DirectedEdge<TWeight>> Path { get; }

Property Value

IEnumerable<DirectedEdge<TWeight>>

Remarks

This is the shortest path from the source to the target of TerminalVertices.

TerminalVertices

The terminal vertices of the diameter.

public (int source, int target) TerminalVertices { get; }

Property Value

(int vertex0, int vertex1)