Пример #1
0
        public void ShowGraphEdgeWeightInfo()
        {
            PriorityQueue <GraphEdge> queue = _edgeQueue;

            while (!queue.IsEmpty())
            {
                GraphEdge edge = queue.Dequeue();
                Console.WriteLine("[" + edge.Vertex1 + ", " + edge.Vertex2 + "] : " + edge.Weight);
            }
        }
Пример #2
0
        public void AddEdge(GraphVertex fromVertex, GraphVertex toVertex, int weight)
        {
            GraphEdge edge = new GraphEdge(fromVertex, toVertex, weight);

            int intFromVertex = (int)fromVertex;
            int intToVertex   = (int)toVertex;

            _lists[intFromVertex].Insert(toVertex);
            _lists[intToVertex].Insert(fromVertex);

            EdgeCount++;

            _edgeQueue.Enqueue(edge);
        }