Which of the following situations would make Bellman-Ford algorithm a better choice than Dijkstra's algorithm?
Finding the shortest path in a tree
Finding the shortest path in a graph with negative edge weights
Finding the shortest path in an unweighted graph
Finding the shortest path in a dense graph
You are designing a social network and want to recommend friends to users. What graph algorithm would be most suitable for identifying potential friends based on shared connections?
Breadth-First Search (BFS)
Depth-First Search (DFS)
Bellman-Ford Algorithm
Dijkstra's Algorithm
Which of the following real-world scenarios is best modeled using a weighted graph with potentially negative edge weights?
Modeling financial transactions where profits and losses are possible
Representing relationships in a family tree
Tracking the spread of information in a social network
Finding the shortest route between two cities on a map
Which algorithm is more suitable for finding the shortest path in a graph with negative edge weights?
Dijkstra's algorithm
Kruskal's algorithm
Bellman-Ford algorithm
Prim's algorithm
What is the purpose of topological sorting in directed acyclic graphs (DAGs)?
Determining if the graph has a Hamiltonian cycle.
Finding a linear ordering of vertices where for every edge (u, v), u comes before v.
Finding the shortest path between any two vertices.
Calculating the minimum spanning tree of the graph.
You are tasked with designing a system to schedule tasks with dependencies between them. What graph data structure would be most appropriate to represent these dependencies?
Complete Graph
Bipartite Graph
Undirected Graph
Directed Acyclic Graph (DAG)
Which of the following algorithms can handle negative weights in a weighted graph without issues?
Prim's Algorithm
In a weighted graph representing a road network with construction delays (represented by negative weights), what does finding the 'shortest path' mean?
Finding the path with the fewest road closures.
Finding the path with the shortest geographical distance.
Finding the path with the least overall travel time, considering delays.
Finding the path with the lowest fuel consumption.
Consider a social network graph where vertices are users and edges are friendships. Which representation would be best for quickly finding all the friends of a particular user?
Edge List
Adjacency List
Incidence Matrix
Adjacency Matrix
In the context of Kruskal's algorithm, what data structure is commonly used to efficiently detect cycles during edge addition?
Disjoint Union Set (Union-Find)
Stack
Heap
Queue