Question: Give an undirected graph G = ( V , E ) with n vertices and m edge, and a positive ( not necessarily unique )
Give an undirected graph with vertices and edge,
and a positive not necessarily unique edge cost for each
edge in We also given q pairs of vertices Q u vuq vq Decide for each pair in if there is a path between and in
Task: Design an algorithm that solves this problem in
time.
Implementation and Testing: Implement your algorithm and
test it on the following graph instances: Graph Graph
Graph Each instance is given as a text file using the
following format:
n
m
vertexId vertexId weight
vertexId vertexId weight
vertexId vertexId weight
vertexId vertexId
vertexId vertexId
For example, the text below describes the instance depicted in Fig.
Note that the vertices are numbered from to and that
the two queries are and
Your program should read input from the text file. Your program
only needs to print out yes, there is a path in between
and or there is no path connecting and in
for each of the query pairs. You should separate each
with a new line. A scaffold is provided for Python.
Your code will not be benchmarked or tested for time complexity, but
for full point it must be able to run instances similar to
"Graph and each test will time out after seconds.
Your program will also be tested on serveral hidden test cases.
If the query is on the figure below then the answer
should be while the answer to the query on the same
graph should be I
Figure I: Illustrating the graph described in with and
python code don't using ai
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
