Speed up integrationUISP.py

* Adds one more "is not none" check for a line that failed on my
  installation.
* Add a level of indentation to the inner "walkGraph" function,
  so it doesn't painstakingly check every node when it already
  knows that it won't pick them (for a route cost).

My testing gave the same results, substantially faster.
This commit is contained in:
Herbert Wolverson 2023-04-21 13:22:07 +00:00
parent c7ca4b171d
commit df3be0b73e

View File

@ -221,13 +221,13 @@ def walkGraphOutwards(siteList, root, routeOverrides):
site['parent'] = parent['id']
#print(debugSpaces(cost/10) + parent['name'] + "->" + site['name'] + " -> New cost: " + str(cost))
for connection in site['connections']:
if not connection in backPath:
#target = findInSiteListById(siteList, connection)
#print(debugSpaces((cost+10)/10) + site['name'] + " -> " + target['name'] + " (" + str(target['cost']) + ")")
newBackPath = backPath.copy()
newBackPath.append(site['id'])
walkGraph(connection, site, cost+10, newBackPath)
for connection in site['connections']:
if not connection in backPath:
#target = findInSiteListById(siteList, connection)
#print(debugSpaces((cost+10)/10) + site['name'] + " -> " + target['name'] + " (" + str(target['cost']) + ")")
newBackPath = backPath.copy()
newBackPath.append(site['id'])
walkGraph(connection, site, cost+10, newBackPath)
for connection in root['connections']:
# Force the parent since we're at the top