add graph router

This commit is contained in:
Laura Klünder 2016-12-05 13:39:22 +01:00
parent 89ed7e25f7
commit 762cb6e317
8 changed files with 115 additions and 4 deletions

View file

@ -13,6 +13,15 @@ class Command(BaseCommand):
parser.add_argument('--no-lines', action='store_const', dest='lines', const=False, default=True,
help='dont draw lines on the graph image')
parser.add_argument('--transfer-points', action='store_const', const=True, default=False,
help='highlight transfer points')
parser.add_argument('--transfer-lines', action='store_const', const=True, default=False,
help='draw in-room transfer lines')
def handle(self, *args, **options):
graph = Graph.load()
graph.draw_pngs(points=options['points'], lines=options['lines'])
if options['transfer_points'] or options['transfer_lines']:
graph.build_router()
graph.draw_pngs(points=options['points'], lines=options['lines'],
transfer_points=options['transfer_points'], transfer_lines=options['transfer_lines'])

View file

@ -0,0 +1,19 @@
import time
from django.core.management.base import BaseCommand
from c3nav.routing.graph import Graph
class Command(BaseCommand):
help = 'check how long it takes to build the routers for the routing graph'
def handle(self, *args, **options):
start = time.time()
graph = Graph.load()
print('Graph loaded in %.4fs' % (time.time() - start))
start = time.time()
graph.build_router()
print('Routers built in %.4fs' % (time.time() - start))
print('%s transfer points' % len(graph.transfer_points))