Interface IMinimumSpanningTreeAlgorithm<TVertex, TEdge, TWeight>
- Namespace
- Graph1x.Algorithms
- Assembly
- Graph1x.dll
A minimum-spanning-tree strategy for undirected graphs. On disconnected graphs implementations return a minimum spanning forest (one tree per connected component). Kruskal and Prim are interchangeable behind this interface.
public interface IMinimumSpanningTreeAlgorithm<TVertex, TEdge, TWeight> where TVertex : notnull where TEdge : IEdge<TVertex> where TWeight : INumber<TWeight>
Type Parameters
TVertexThe vertex type.
TEdgeThe edge type.
TWeightThe numeric weight type.
Methods
FindMinimumSpanningForest(IReadOnlyGraph<TVertex, TEdge>)
Computes a minimum spanning forest of the graph.
IReadOnlyList<TEdge> FindMinimumSpanningForest(IReadOnlyGraph<TVertex, TEdge> graph)
Parameters
graphIReadOnlyGraph<TVertex, TEdge>The undirected graph to span.
Returns
- IReadOnlyList<TEdge>
The chosen edges: |V| - #components of them, total weight minimal.
Exceptions
- ArgumentException
graphis directed.