Satsuma
a delicious .NET graph library
|
Finds a minimum cost spanning forest in a graph using Prim's algorithm. More...
Public Member Functions | |
Prim (IGraph graph, Func< Arc, TCost > cost) | |
Prim (IGraph graph, Dictionary< Arc, TCost > cost) | |
Properties | |
Func< Arc, TCost > | Cost [get, set] |
HashSet< Arc > | Forest [get, set] |
Contains the arcs of a cheapest spanning forest. More... | |
Subgraph | ForestGraph [get, set] |
The cheapest spanning forest as a subgraph of the original graph. More... | |
IGraph | Graph [get, set] |
Finds a minimum cost spanning forest in a graph using Prim's algorithm.
Most suitable for dense graphs. For sparse (i.e. everyday) graphs, use Kruskal<TCost>.
Running time: O((m+n) log n), memory usage: O(n); where n is the number of nodes and m is the number of arcs.
Example:
TCost | The arc cost type. |
TCost | : | IComparable<TCost> |
Definition at line 55 of file SpanningForest.cs.
Definition at line 66 of file SpanningForest.cs.
Definition at line 77 of file SpanningForest.cs.
|
getset |
Definition at line 59 of file SpanningForest.cs.
|
getset |
Contains the arcs of a cheapest spanning forest.
Definition at line 62 of file SpanningForest.cs.
|
getset |
The cheapest spanning forest as a subgraph of the original graph.
Definition at line 64 of file SpanningForest.cs.
|
getset |
Definition at line 58 of file SpanningForest.cs.