Intermediate stations

17 views
Skip to first unread message

fiddler

unread,
Mar 30, 2011, 6:17:07 PM3/30/11
to Graphserver
Is there any way to identify the intermediate stations between the
boarding station and the alight station? Alternately, is there any way
to get location data for a psv node?

Please respond.

Brandon Martin-Anderson

unread,
Mar 30, 2011, 6:56:23 PM3/30/11
to graph...@googlegroups.com
Hello,

Given a PSV, follow the alight edge to the stop vertex, check the vertex ID, and use that to look up the station location in whatever database or GTFS file you ingested to create your graph.

-B


--
You received this message because you are subscribed to the Google Groups "Graphserver" group.
To post to this group, send email to graph...@googlegroups.com.
To unsubscribe from this group, send email to graphserver...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/graphserver?hl=en.


fiddler

unread,
Mar 31, 2011, 5:47:47 PM3/31/11
to Graphserver
Thank you for your suggestion. Would someone be willing to tell me
exactly how to "follow the alight edge to the stop vertex"? Given a
graph g and a psv-node psv, I know that I can do the following to find
the "alight" edge (though it's rather messy):

for edge in (g.get_vertex(psv.label).outgoing):
if (str(edge).startswith("<Edge><TripAlight")):
alight_edge = edge

However, I don't know how to find the node at the end of the alight
edge.

Your help will be greatly appreciated.

-C

On Mar 30, 5:56 pm, Brandon Martin-Anderson <badh...@gmail.com> wrote:
> Hello,
>
> Given a PSV, follow the alight edge to the stop vertex, check the vertex ID,
> and use that to look up the station location in whatever database or GTFS
> file you ingested to create your graph.
>
> -B
>

fiddler

unread,
Mar 31, 2011, 12:49:07 PM3/31/11
to Graphserver
Thank you so much. Could you be a bit more specific about how to
follow the alight edge to a stop vertex? I can find all the outgoing
edges from a psv node by calling
graph.get_vertex(psv_node.label).outgoing and select the edge that
starts with "<Edge><TripAlight", but I can't figure out how to find
the node at the other end. Should I be doing a database search? Is
end_node an attribute of an edge?


On Mar 30, 5:56 pm, Brandon Martin-Anderson <badh...@gmail.com> wrote:
> Hello,
>
> Given a PSV, follow the alight edge to the stop vertex, check the vertex ID,
> and use that to look up the station location in whatever database or GTFS
> file you ingested to create your graph.
>
> -B
>

Brandon Martin-Anderson

unread,
Apr 3, 2011, 12:55:53 PM4/3/11
to graph...@googlegroups.com
Hi C,

To find the station vertex corresponding to a PSV vertex, something like this would work:

def station_vertex( g, psv_label ):
  for edge in (g.get_vertex(psv_label).outgoing):
    if type(edge.payload) == TripAlight:
      return edge.to_v

  # no edge with a TripAlight outgoing from the vertex with label psv_label could be found; will return None

fiddler

unread,
Apr 6, 2011, 4:17:10 PM4/6/11
to Graphserver
Thank you so much. My project is saved!

-C

On Apr 3, 11:55 am, Brandon Martin-Anderson <badh...@gmail.com> wrote:
> Hi C,
>
> To find the station vertex corresponding to a PSV vertex, something like
> this would work:
>
> def station_vertex( g, psv_label ):
>   for edge in (g.get_vertex(psv_label).outgoing):
>     if type(edge.payload) == TripAlight:
>       return edge.to_v
>
>   # no edge with a TripAlight outgoing from the vertex with label psv_label
> could be found; will return None
>
Reply all
Reply to author
Forward
0 new messages