Class GraphMinimumSpanningTreeExtensions
- Namespace
- Graph1x.Algorithms
- Assembly
- Graph1x.dll
Convenience entry points for minimum-spanning-forest queries. These default to Kruskal; instantiate PrimMinimumSpanningTree<TVertex, TEdge, TWeight> directly to use Prim.
public static class GraphMinimumSpanningTreeExtensions
- Inheritance
-
GraphMinimumSpanningTreeExtensions
- Inherited Members
Methods
MinimumSpanningForest<TVertex, TWeight>(IReadOnlyGraph<TVertex, WeightedEdge<TVertex, TWeight>>)
Computes a minimum spanning forest using Kruskal's algorithm and the weights carried by the graph's WeightedEdge<TVertex, TWeight> edges.
public static IReadOnlyList<WeightedEdge<TVertex, TWeight>> MinimumSpanningForest<TVertex, TWeight>(this IReadOnlyGraph<TVertex, WeightedEdge<TVertex, TWeight>> graph) where TVertex : notnull where TWeight : INumber<TWeight>
Parameters
graphIReadOnlyGraph<TVertex, WeightedEdge<TVertex, TWeight>>The undirected graph to span.
Returns
- IReadOnlyList<WeightedEdge<TVertex, TWeight>>
The chosen edges.
Type Parameters
TVertexThe vertex type.
TWeightThe numeric weight type.
Exceptions
- ArgumentException
graphis directed.
MinimumSpanningForest<TVertex, TEdge, TWeight>(IReadOnlyGraph<TVertex, TEdge>, Func<TEdge, TWeight>)
Computes a minimum spanning forest using Kruskal's algorithm and
weightSelector to read edge weights.
public static IReadOnlyList<TEdge> MinimumSpanningForest<TVertex, TEdge, TWeight>(this IReadOnlyGraph<TVertex, TEdge> graph, Func<TEdge, TWeight> weightSelector) where TVertex : notnull where TEdge : IEdge<TVertex> where TWeight : INumber<TWeight>
Parameters
graphIReadOnlyGraph<TVertex, TEdge>The undirected graph to span.
weightSelectorFunc<TEdge, TWeight>Maps an edge to its weight.
Returns
- IReadOnlyList<TEdge>
The chosen edges.
Type Parameters
TVertexThe vertex type.
TEdgeThe edge type.
TWeightThe numeric weight type.
Exceptions
- ArgumentException
graphis directed.