예제 #1
0
 def obj_get_list(self, bundle, **kwargs):
   lz = LazyGraph()
   nd = lz.get_node_dict()
   edges = [edge for edge in Edge.objects.all()]
   for edge in edges:
     edge.node_src = nd[edge.node_src_id]
     edge.node_sink = nd[edge.node_sink_id]
   
   return edges
예제 #2
0
파일: res.py 프로젝트: ylou/mapcampus
  def obj_get_list(self, bundle, **kwargs):
    from_id = int(bundle.request.GET.get('from_id', -1))
    to_id = int(bundle.request.GET.get('to_id', -1))

    if from_id != -1 and to_id != -1:
      from_building = Building.objects.get(id=from_id)
      to_building = Building.objects.get(id=to_id)

      node_from_id = from_building.centroid_id
      node_to_id = to_building.centroid_id

      lz = LazyGraph()
      length, path = nx.bidirectional_dijkstra(lz.get_graph(), node_from_id, node_to_id, weight='weight')

      return [Node.objects.get(id=x) for x in path]

    return []
예제 #3
0
  def obj_get_list(self, bundle, **kwargs):
    from_id = int(bundle.request.GET.get('from_id', -1))
    to_id = int(bundle.request.GET.get('to_id', -1))

    if from_id != -1 and to_id != -1:
      from_building = Building.objects.get(id=from_id)
      to_building = Building.objects.get(id=to_id)

      node_from_id = Node.objects.filter(building=from_building)[0].id
      node_to_id = Node.objects.filter(building=to_building)[0].id

      lz = LazyGraph()
      nd = lz.get_node_dict()
      length, path = nx.bidirectional_dijkstra(lz.get_graph(), from_id, to_id, weight='weight')

      return [nd[x] for x in path]

    return []
예제 #4
0
def foo():
  lz = LazyGraph()
  lz.get_graph()
예제 #5
0
 def obj_get_list(self, bundle, **kwargs):
   lz = LazyGraph()
   return lz.get_node_dict().values()
예제 #6
0
def foo():
    lz = LazyGraph()
    lz.get_graph()