How to modify the graph after loading

tl;dr: I got a frozen graph, I’d like to add virtual nodes and edges to it. Either by modifying the graph or by copying it merged with my additions. How would I go about that?

I want to add virtual nodes to the graph after it has loaded. However, the graph is then in a frozen state. The examples only seem to detail how to modify a new graph. I don’t think I can easily unfreeze a graph (aside from reflection). Is there a way to merge a loaded graph (from an osm pbf file) and a self made one?

Do you mean to create a QueryGraph? That works when the graph is frozen.

Is this what you actually want to do?

This is really just a means for this: Set TSP in jsprit?

My idea is:

  • for every set of locations (e.g. all nodes in a osm tile at a certain zoom level, roughly one mile by one mile), I create a virtual node with edges to these actual nodes
  • I could then ask graphhopper to route from one such virtual node to another virtual node and I’d get the shortest / most optimal path that connects the two OSM tiles
  • Now the set traveling salesman problem is reduced to a regular traveling salesman problem
  • I’d then feed the distances / costs of these paths to jsprit and let it solve the TSP

I don’t quite see yet how I can use QueryGraphs for that, am I missing something?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.