USE PYTHON No imports can be used input the txt file and find the shortest path that begins and ends at the vertex with label 1. This path must have at least one edge. Your answer should be a list...


USE PYTHON


No imports can be used


input the txt file and find the shortest path that begins and ends at the vertex with label 1. This path must have at least one edge. Your answer should be a list containing the vertices in the path starting at 1. Shortest refers to the path with the fewest number of vertices.


The Txt file is below


1 2
1 8
2 3
2 5
2 12
2 9
2 16
3 2
3 10
4 1
4 10
5 2
5 16
6 8
6 18
7 6
7 20
8 4
8 6
9 2
9 5
9 17
10 3
10 5
10 20


... so here it should be(1, 8) -> (8, 4) --> (4, 1)



Jun 09, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here