modules/query/LineGraphTable.js
function getPaths(db, originId, destinationId, callback) {

  // Get Graph
  buildGraph(db, function(err, graph) {
    if ( err ) {
      return callback(err);
    }

    // Paths to return
    let rtn = [];

    // Search the Graph
    for ( let it = graph.paths(originId, destinationId), kv; !(kv = it.next()).done;) {
      let path = [];
      for ( let i = 0; i < kv.value.length; i++ ) {
        let stop = graph.vertexValue(kv.value[i]);
        path.push({
          id: stop.id,
          weight: stop.transferWeight
        });
      }
      rtn.push(path);
    }

    // Return the paths
    return callback(null, rtn);

  });

}
function getPaths(db, originId, destinationId, callback) {

  // Get Graph
  buildGraph(db, function(err, graph) {
    if ( err ) {
      return callback(err);
    }

    // Paths to return
    let rtn = [];

    // Search the Graph
    for ( let it = graph.paths(originId, destinationId), kv; !(kv = it.next()).done;) {
      let path = [];
      for ( let i = 0; i < kv.value.length; i++ ) {
        let stop = graph.vertexValue(kv.value[i]);
        path.push({
          id: stop.id,
          weight: stop.transferWeight
        });
      }
      rtn.push(path);
    }

    // Return the paths
    return callback(null, rtn);

  });

}
function getPaths ( db , originId , destinationId , callback ) { // Get Graph buildGraph ( db , function ( err , graph ) { if ( err ) { return callback ( err ) ; } // Paths to return let rtn = [ ] ; // Search the Graph for ( let it = graph . paths ( originId , destinationId ) , kv ; ! ( kv = it . next ( ) ) . done ; ) { let path = [ ] ; for ( let i = 0 ; i < kv . value . length ; i ++ ) { let stop = graph . vertexValue ( kv . value [ i ] ) ; path . push ( { id : stop . id , weight : stop . transferWeight } ) ; } rtn . push ( path ) ; } // Return the paths return callback ( null , rtn ) ; } ) ; }
Get all possible paths from the origin to the destination following the
Agency Line Graph
@param {RightTrackDB} db The Right Track DB to Query
@param {String} originId Origin Stop ID
@param {String} destinationId Destination Stop ID
@param {function} callback Callback Function
@param {Error} callback.err Database Query Error
@param {Object[][]} [callback.paths] Route Paths
@param {String} callback.paths[].id Stop ID
@param {int} callback.paths[].weight Stop Transfer Weight
Get all possible paths from the origin to the destination following the Agency Line Graph