finding longest path in a graph
问题 I am trying to solve a program, where in I have to find the max number of cities connected for a given list of routes. for eg: if the given route is [['1', '2'], ['2', '4'], ['1', '11'], ['4', '11']] then max cities connected will be 4 constraint is I can't visit a city which I already have visited. I need ideas, as in how to progress. For now, What I have thought is if I could be able to create a dictionary with cities as a key and how many other cities its connected to as its value, i get