Skip to content
Zsombor Welker edited this page Jun 20, 2013 · 3 revisions

Raptor is an alternative transit routing algorithm that is faster on large networks (NYC) and not much slower on small networks. In general, its performance is more predictable than the default A*; there are fewer very long queries, although also fewer very short queries.

Here is a paper describing the algorithm

OTP's implementation of Raptor is designed to be compatible with the rest of OTP's routing flexibility. So it continues to use Dijkstra's algorithm for the non-transit portions of the trip.

To use Raptor, you must ensure that the following two sections are in your graph-builder.xml:

    <bean id="gtfsBuilder" class="org.opentripplanner.graph_builder.impl.GtfsGraphBuilderImpl">
      ...
      <property name="gtfsGraphBuilders">
          <list>
            <bean class="org.opentripplanner.graph_builder.impl.transit_index.TransitIndexBuilder"/>
          </list>
        </property>
    </bean>

And

     <bean id="graphBuilderTask" class="org.opentripplanner.graph_builder.GraphBuilderTask">
        ...
        <property name="graphBuilders">
            <list>
               <ref bean="gtfsBuilder" />
                <ref bean="osmBuilder" />
                <ref bean="pruneFloatingIslands" />
                <ref bean="transitStreetLink" />
                <!-- optional but good for speed -->
                <bean id="transitLocalStreets" class="org.opentripplanner.graph_builder.impl.transit_local_streets.TransitLocalStreetComputer" />
                <!-- required -->
                <bean id="raptorDataBuilder" class="org.opentripplanner.graph_builder.impl.raptor.RaptorDataBuilder" />
            </list>
        </property>

Then you must edit your application-context.xml to replace the pathService with:

<bean id="pathService" class="org.opentripplanner.routing.impl.raptor.Raptor">
    <property name="multiPathTimeout" value="1.0" />
</bean>

You will also need to have this (RAPTOR uses it as a fallback for non-transit routes and even short transit routes):

<bean id="sptService" class="org.opentripplanner.routing.algorithm.GenericAStar"/>
Clone this wiki locally