sp.between               package:RBGL               R Documentation

_D_i_j_k_s_t_r_a'_s _s_h_o_r_t_e_s_t _p_a_t_h_s _u_s_i_n_g _b_o_o_s_t _C++

_D_e_s_c_r_i_p_t_i_o_n:

     dijkstra's shortest paths

_U_s_a_g_e:

     sp.between.scalar(g,start,finish, eW=unlist(edgeWeights(g))) 
     sp.between(g,start,finish) 
     sp.between.old(g,start,finish) 

_A_r_g_u_m_e_n_t_s:

       g: instance of class graph 

   start: character: node name(s) for start of path  

  finish: character vector: node names for end of path

      eW: numeric: edge weights.  

_D_e_t_a_i_l_s:

     These functions are interfaces to the Boost graph library C++
     routines for Dijkstra's shortest paths.

_V_a_l_u_e:

     'sp.between.scalar' returns a list with elements: 

  length: length (using edge weights) of shortest path

    path: vector of node names describing the path

pweights: named vector of edge weights for all weights constituting the
          path - see 'pathWeights' for caveats about undirected graph
          representation.


     Note that if 'start' or 'finish' are vectors, a list of results of
     repeated application of 'sp.between.scalar' is returned.

_N_o_t_e:

     sp.between returns a list whose size depends upon the start and
     finish arguments.  If start and finish are both scalar, then a
     list is returned with elements the length of the shortest path and
     the vector of nodes comprising that path.  If one of start or
     finish is an n-vector, n>1, and the other is an atom, a list is
     returned with n elements, each element of which is a list
     possessing a length and path element.  If both start and finish
     are n-vectors, a list of n elements is returned, with ith element
     the distance and path between start[i] and finish[i].  It is an
     error to have start and finish of different nonunity lengths.

     sp.between.old is included for archival purposes.

_A_u_t_h_o_r(_s):

     VJ Carey <stvjc@channing.harvard.edu>

_S_e_e _A_l_s_o:

     'bellman.ford.sp', 'dag.sp', 'dijkstra.sp', 'johnson.all.pairs.sp'

_E_x_a_m_p_l_e_s:

     ospf <- fromGXL(file(system.file("XML/ospf.gxl",package="RBGL"), open="r"))
     dijkstra.sp(ospf,nodes(ospf)[6])
     sp.between(ospf, "RT6", "RT1")
     sp.between(ospf, c("RT6", "RT2"), "RT1")
     sp.between(ospf, c("RT6", "RT2"), c("RT1","RT5"))
     if (interactive()) # see an error for query on nonexistent path
     sp.between(ospf,"N10", "N13")

