pub fn prim(
store: &LpgStore,
weight_property: Option<&str>,
start: Option<NodeId>,
) -> MstResultExpand description
Computes the Minimum Spanning Tree using Prim’s algorithm.
Prim’s algorithm grows the MST from a starting node, always adding the minimum weight edge that connects a tree node to a non-tree node.
§Arguments
store- The graph storeweight_property- Optional property name for edge weights (defaults to 1.0)start- Optional starting node (defaults to first node)
§Returns
The MST edges and total weight.
§Complexity
O(E log V) using a binary heap