Questions
Questions

XLMC0202501 Topic 20 Quiz

Single choice

Suppose a graph data structure is used to represent direct travel links between cities.   Nodes in the graph represent cities and there is an undirected edge from city X to city Y if it is possible to travel directly between those two cities.    If the primary use of this graph is to query whether direct travel between two cities is possible, which graph data structure would be more efficient in terms of the time required to complete the query?    

Options
A.Adjacency Matrix
B.Adjacency List
View Explanation

View Explanation

Verified Answer
Please login to view
Step-by-Step Analysis
When assessing which graph representation yields faster queries for direct connectivity between two cities, we should compare how each structure supports edge existence checks. Option: Adjacency Matrix - In an adjacency matrix, edge presence between any two nodes can be checked in constant time by inspecting the entry at matrix[u][v]. For an undirected graph, matrix[u][v......Login to view full explanation

Log in for full answers

We've collected over 50,000 authentic exam questions and detailed explanations from around the globe. Log in now and get instant access to the answers!

Similar Questions

More Practical Tools for Students Powered by AI Study Helper

Join us and instantly unlock extensive past papers & exclusive solutions to get a head start on your studies!