http://alrightchiu.github.io/SecondRound/all-pairs-shortest-pathfloyd-warshall-algorithm.html http://slideplayer.com/slide/4393766/14/images/28/Some+Algorithms+When+no+negative+edges.jpg https://stackoverflow.com/questions/26547816/understanding-time-complexity-calculation-for-dijkstra-algorithm void Solution::dijkstraSingleSource(vector<list<pair<int, int> > > &edge, int src) { set< pair<int, int> > active_vertices; active_vertices.insert(make_pair(0, src)); while (active_vertices.size() != 0) { int vertex = (active_vertices.begin())->second; active_vertices.erase(make_pair(shortestDist[src][vertex], vertex)); list<pair<int, int> >::iterator iter; for (iter = edge[vertex].begin(); iter != edge[vertex].end(); iter++) { int dist = iter->first; int edgeLength = iter->second; if ((shortestDist[src][vertex] + edgeLength) < shorte...
留言
張貼留言