only vertex a
only vertices a, e, f, g, h
only vertices a, b, c, d
all the vertices
Dijkstra’s algorithm starting from S.
Performing a DFS starting from S.
Performing a BFS starting from S.
P, Q, R, S, T, U
P, Q, R, U, S, T
P, Q, R, U, T, S
P, Q, T, R, U, S
1 1 1 s-----a-----b-----t \ / \ / \______/ 4
If we make following changes to Dijkstra, then it can be used to find the longest simple path, assume that the graph is acyclic. 1) Initialize all distances as minus infinite instead of plus infinite. 2) Modify the relax condition in Dijkstra's algorithm to update distance of an adjacent v of the currently considered vertex u only if "dist[u]+graph[u][v] > dist[v]". In shortest path algo, the sign is opposite.
Strongly Connected Component
Given a directed graph where weight of every edge is same, we can efficiently find shortest path from a given source to destination using?
Breadth First Traversal
Dijkstra's Shortest Path Algorithm
Neither Breadth First Traversal nor Dijkstra's algorithm can be used
Depth First Search
With BFS, we first find explore vertices at one edge distance, then all vertices at 2 edge distance, and so on.