DEA-C01 Question 138
Single answerA company uses Amazon Neptune to store and query their graph-based social network data. They want to find the shortest path between two users in the network to recommend connections. Which algorithm should they use for this purpose?
- A
Dijkstra's Algorithm
- B
Depth-First Search (DFS)
- C
Breadth-First Search (BFS)
- D
PageRank Algorithm
Show answer and explanation
Correct answer: A
Explanation
In this scenario, the company needs to find the shortest path between two nodes (users) in a graph. Since social networks often involve weighted relationships (e.g., strength of connection), Dijkstra's Algorithm is the most appropriate choice for finding the shortest path in a weighted graph. Other algorithms like DFS and BFS are not optimal for this use case, and PageRank serves a completely different purpose.
- A. Correct.
Dijkstra's Algorithm is the correct choice for finding the shortest path in a weighted graph, which is common in social network analysis.
- B. Incorrect.
Depth-First Search (DFS) is used to traverse or search through a graph but does not guarantee the shortest path.
- C. Incorrect.
Breadth-First Search (BFS) can find the shortest path in an unweighted graph, but it is not suitable for weighted graphs.
- D. Incorrect.
PageRank Algorithm is designed for ranking nodes in a graph based on their importance and is not used for shortest path calculations.