Пример #1
0
        /// <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);
        }
Пример #2
0
 /// <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);
 }