/// <summary> /// Uses Prim's algorithm to build an MST spanning the mstNodes. /// O(|mstNodes|^2) runtime. /// </summary> /// <param name="startIndex">The node index to start from.</param> public void Span(int startIndex) { var edges = new FunctionalTwoDArray <DirectedGraphEdge>((a, b) => new DirectedGraphEdge(a, b, _distances[a, b])); Span(startIndex, edges); }
/// <summary> /// Uses Prim's algorithm to build an MST spanning the mstNodes. /// O(|mstNodes|^2) runtime. /// </summary> /// <param name="startIndex">The node index to start from.</param> public void Span(int startIndex) { var edges = new FunctionalTwoDArray<DirectedGraphEdge>((a, b) => new DirectedGraphEdge(a, b, _distances[a, b])); Span(startIndex, edges); }