concept weighted path in category algorithms

This is an excerpt from Manning's book Classic Computer Science Problems in Python.
result will ultimately hold the weighted path containing the minimum spanning tree. This is where we will add WeightedEdges, as the lowest-weight edge is popped off and takes us to a new part of the graph. Jarník’s algorithm is considered a greedy algorithm because it always selects the lowest-weight edge. pq is where newly discovered edges are stored and the next-lowest-weight edge is popped. visited keeps track of vertex indices that we have already been to. This could also have been accomplished with a Set, similar to explored in bfs().

This is an excerpt from Manning's book Classic Computer Science Problems in Swift: Essential techniques for practicing programmers.
result will ultimately hold the weighted path containing the minimum spanning tree. This is where we will add WeightedEdges, as the lowest-weight edge is popped off and takes us to a new part of the graph. Jarnik’s algorithm is considered a greedy algorithm because it always selects the lowest-weight edge. pq is where newly discovered edges are stored and the next-lowest-weight edge is popped. visited keeps track of vertex indices that we have already been to. This could also have been accomplished with a Set, similar to explored in bfs().