private void Init() { foreach (var v in graph.Vertices) { MST.AddVertex(v); } }
private void Init() { componentOfMST = new bool[graph.Size]; queue = new PriorityQueue <IEdge <V, int> >((a, b) => a.Value - b.Value); foreach (var v in graph.Vertices) { MST.AddVertex(v); } Visit(source); }
private void Init() { queue = new PriorityQueue <IEdge <V, int> >(); for (int i = 0; i < graph.Size; i++) { componentOfMST[i] = false; distTo[i] = INFINITY; } foreach (var v in graph.Vertices) { MST.AddVertex(v); } Visit(source); }
private void Init() { for (int i = 0; i < graph.Size; i++) { componentOfMST[i] = false; neighbor[i] = source; distance[i] = INFINITY; } foreach (var v in graph.GetNeighbours(source)) { distance[v.ID] = graph.GetEdge(source, v).Value; } foreach (var v in graph.Vertices) { MST.AddVertex(v); } componentOfMST[source.ID] = true; }