示例#1
0
 private void Init()
 {
     foreach (var v in graph.Vertices)
     {
         MST.AddVertex(v);
     }
 }
示例#2
0
        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;
        }