+ 2

Can someone write a Python program which returns the longer of the shortest way between two points(for ex. fixed A and B) if there is a way exists between points and if there s no way between those 2 points the function returns -1

Please help thank you alot ;)

21st May 2017, 10:21 PM
Ali
Ali - avatar
4 Respuestas
+ 1
What do you mean by longer way? On an open board, there is no limit to how long a path can be. And in any type of system, a path can be retraced an infinite amount of times, so you could make the path as long as you want.
21st May 2017, 11:03 PM
Jake
Jake - avatar
0
this sounds like homework, and we're not here to give full answers. Try breaking the problem down into how you think it could be solved and implement with code as much as possible. if you succeed, brilliant! If not, describe how you've tried to tackle it, your code, where you're stuck etc and people will be happy to help
21st May 2017, 11:23 PM
tracy
tracy - avatar
0
Hello I mean, there is a way between those points (a graph) but we don,t know the graph so, programm will ask if we found B at every point of the way and at the end of the way, if no1 of points is point B then program will return -1 if not, program will return the way. (We suppose ther s a graph between points A et B we start way from A and we check that if we can find B) Btw its a discussion its not an homework ..;) Thank you all
22nd May 2017, 6:00 AM
Ali
Ali - avatar
0
print("Homework alert")
13th Jan 2018, 9:00 AM
VcC
VcC - avatar