<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">Hi Wesam,<br>
      <br>
      > do you think that the QueryGraph approach will work for
      multiple vehicles distributed on the graph?<br>
      <br>
      It could be that the QueryGraph is not the most performant
      solution, but if you only have a few hundreds or even thousands,
      it might work. I have tested it up to 10K without having problems
      but it could be that there are problems for more locations. <br>
      <br>
      Also the QueryGraph is intended to be as much lightweight as
      possible so 'frequent throw aways' should be fine.<br>
      <br>
      > will try to find the closest street node to the vehicle and
      mark it (in a seperate hashtable) <br>
      > to be a vehicle representative node and will be handled
      differently in the routing algorithm<br>
      <br>
      For that just use QueryResult.getClosestNode obtained from the
      location index.<br>
      <br>
      <br>
      > The disadvantage here is clearly that the street node might
      be far away from the vehicle position. <br>
      <br>
      Yes, you'll need to calculate the splitted weight, geometry etc
      ... which is done in QueryGraph already<br>
      <br>
      > Later on I might think of splitting the street edge. I
      thought this might be easier to start with. what do you think? <br>
      <br>
      Yes, this is exactly what we are doing in QueryGraph and it is not
      easy :)<br>
      Assume you have multiple vehicles on the same edge ... this should
      be all supported from QueryGraph already. Probably the first trial
      could be indeed with QueryGraph and switch to something else if
      this won't work or is too slow.<br>
      <br>
      Would be interesting to make the QueryGraph useful for this kind
      of use case too.<br>
      <br>
      Regards,<br>
      Peter<br>
      <br>
      On 24.07.2015 11:17, wesam Herbawi wrote:<br>
    </div>
    <blockquote
cite="mid:CALqm3gBE1=hwr961HuoFqoOVX5H++cTg89KpgBUW=YasMxidKA@mail.gmail.com"
      type="cite">
      <div dir="ltr">Many thanks Peter,
        <div>do you think that the QueryGraph approach will work for
          multiple vehicles distributed on the graph? I am thinking of
          updating the QueryGraph on regular basis, e.g. every 10
          minutes, not per query.</div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div>Away from the QueryGraph approach, as a start, I will try
          to find the closest street node to the vehicle and mark it (in
          a seperate hashtable) to be a vehicle representative node and
          will be handled differently in the routing algorithm. The
          disadvantage here is clearly that the street node might be far
          away from the vehicle position. Later on I might think of
          splitting the street edge. I thought this might be easier to
          start with. what do you think? </div>
        <div><br>
        </div>
        <div><br>
        </div>
      </div>
      <div class="gmail_extra"><br>
        <div class="gmail_quote">On 23 July 2015 at 20:38, Peter <span
            dir="ltr"><<a moz-do-not-send="true"
              href="mailto:graphhopper@gmx.de" target="_blank">graphhopper@gmx.de</a>></span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div bgcolor="#FFFFFF" text="#000000">
              <div>Hi anonymous,<span class=""><br>
                  <br>
                  <br>
                  > So during the time of creating the street graph,
                  the vehicles' nodes will be <br>
                  > considered and have their own indecies in the
                  original nodes array. <br>
                  <br>
                </span> Yes, that was what I meant.<br>
                <br>
                But now I know better what you mean with this kind of
                car sharing. Then it is indeed a bit different and I
                would assign the position to the two nodes of the edge,
                but associated with a different weight in the algorithm
                reflecting the precise position and skipping node(s) in
                case of one ways.<br>
                <br>
                The problematic is indeed very similar to the
                "QueryGraph vs. precise GPS routing" discussion:<br>
                <a moz-do-not-send="true"
                  href="https://github.com/graphhopper/graphhopper/issues/27"
                  target="_blank">https://github.com/graphhopper/graphhopper/issues/27</a><br>
                <a moz-do-not-send="true"
                  href="https://github.com/graphhopper/graphhopper/pull/115"
                  target="_blank">https://github.com/graphhopper/graphhopper/pull/115</a><br>
                <br>
                <br>
                <div><span class="">> sorry for the long discussion.
                    just trying to understand the alternatives before
                    going further.<br>
                    <br>
                  </span> No problem. Interesting use case.<br>
                  <br>
                </div>
                Regards,<br>
                Peter
                <div>
                  <div class="h5"><br>
                    <br>
                    On 23.07.2015 18:52, graphhopper newbie wrote:<br>
                  </div>
                </div>
              </div>
              <div>
                <div class="h5">
                  <blockquote type="cite">
                    <div dir="ltr">If I correctly understand you, this
                      would solve the problem of adding vehicle
                      representative nodes. So during the time of
                      creating the street graph, the vehicles' nodes
                      will be considered and have their own indecies in
                      the original nodes array. However, what I miss is
                      how to maintain the dynamic edges. when a vehicle
                      is parked somewhere, an edge has to be added to
                      connect it to the closest street node and the
                      previous connecting edges have to be removed.
                      <div><br>
                      </div>
                      <div><br>
                      </div>
                      <div>Another interpretation that might be what you
                        mean is that not to add vehicle nodes at all and
                        consider the closest original street node to the
                        vehicle to be the vehicle representative node
                        and to add it to the data structure you
                        mentioned earlier. if this is the case then I
                        would miss some information I was planning to
                        model using the edge connecting the street node
                        and the vehicle node (still can be done
                        implicitly) </div>
                      <div><br>
                      </div>
                      <div>sorry for the long discussion. just trying to
                        understand the alternatives before going
                        further.</div>
                      <div><br>
                      </div>
                      <div>Regards</div>
                      <div class="gmail_extra"><br>
                        <div class="gmail_quote">On 23 July 2015 at
                          16:58, Peter <span dir="ltr"><<a
                              moz-do-not-send="true"
                              href="mailto:graphhopper@gmx.de"
                              target="_blank">graphhopper@gmx.de</a>></span>
                          wrote:<br>
                          <blockquote class="gmail_quote"
                            style="margin:0 0 0 .8ex;border-left:1px
                            #ccc solid;padding-left:1ex">
                            <div bgcolor="#FFFFFF" text="#000000">
                              <div>I would just mark (in a different
                                data structure) that these nodes are
                                special e.g. in an array or
                                (RAM)DataAccess which is more complex
                                but also storable and scales to GB.<br>
                                <br>
                                This way you don't need to remove/re-add
                                them and instead can just remove the
                                marker from the array. A lot easier IMO.<br>
                                <br>
                                Regards,<br>
                                Peter<span><br>
                                  <br>
                                  On 23.07.2015 16:17, graphhopper
                                  newbie wrote:<br>
                                </span></div>
                              <span>
                                <blockquote type="cite">
                                  <div dir="ltr">Thanks for the reply,
                                    <div>The use case makes the
                                      situation dynamic. Assume that you
                                      have free floating carsharing
                                      vehicles. Let us assume that these
                                      vehicles can be parked
                                      everywehere. what I wanted to do
                                      is to periodically link these
                                      vehicles to the closest nodes in
                                      the original street graph (remove
                                      old links when vehicles change
                                      their positions). This way the
                                      vehicles will be represented as
                                      nodes in the graph and routing
                                      will be easier later. My routing
                                      algorithm has to be able to switch
                                      from walk to drive mode when such
                                      vehicle node is found. the goal is
                                      to have walk-drive-walk route in
                                      one Dijkstra run.</div>
                                    <div><br>
                                    </div>
                                    <div>Regards,</div>
                                  </div>
                                  <div class="gmail_extra"><br>
                                    <div class="gmail_quote">On 23 July
                                      2015 at 15:47, Peter <span
                                        dir="ltr"><<a
                                          moz-do-not-send="true"
                                          href="mailto:graphhopper@gmx.de"
                                          target="_blank">graphhopper@gmx.de</a>></span>
                                      wrote:<br>
                                      <blockquote class="gmail_quote"
                                        style="margin:0 0 0
                                        .8ex;border-left:1px #ccc
                                        solid;padding-left:1ex">
                                        <div bgcolor="#FFFFFF"
                                          text="#000000">
                                          <div>Hi,<br>
                                            <br>
                                            you can, but there is
                                            currently no way to remove
                                            such edges (efficiently).<br>
                                            <br>
                                            Another workaround would be
                                            to use the QueryGraph for
                                            this like we use to
                                            introduce virtual nodes and
                                            edges to incorporate the
                                            start+end GPS point into the
                                            graph. But never tried this.<br>
                                            <br>
                                            Why not always add all such
                                            points to the graph, why is
                                            a dynamic scenario needed
                                            here?<br>
                                            <br>
                                            Kind Regards,<br>
                                            Peter
                                            <div>
                                              <div><br>
                                                <br>
                                                On 23.07.2015 15:42,
                                                graphhopper newbie
                                                wrote:<br>
                                              </div>
                                            </div>
                                          </div>
                                          <blockquote type="cite">
                                            <div>
                                              <div>
                                                <div dir="ltr">Hi
                                                  everybody,
                                                  <div>I am wondering if
                                                    I can add nodes and
                                                    edges to the graph
                                                    after its creation
                                                    in a dynamic way. I
                                                    need this
                                                    functionality to
                                                    deal with dynamic
                                                    scenarios like
                                                    representing
                                                    available
                                                    bikesharing/carsharing
                                                    points which changes
                                                    often. The simpist
                                                    case I need is to
                                                    add an edge from a
                                                    newly added node (
                                                    representing the
                                                    available bike) to
                                                    the closest node in
                                                    the graph and the
                                                    reverse edge. i.e.
                                                    from the closest
                                                    node to the the bike
                                                    node. </div>
                                                  <div><br>
                                                  </div>
                                                  <div>Thank you very
                                                    much,<br>
                                                  </div>
                                                </div>
                                              </div>
                                            </div>
                                          </blockquote>
                                        </div>
                                      </blockquote>
                                    </div>
                                  </div>
                                </blockquote>
                              </span></div>
                          </blockquote>
                        </div>
                      </div>
                    </div>
                  </blockquote>
                </div>
              </div>
            </div>
          </blockquote>
        </div>
      </div>
    </blockquote>
  </body>
</html>