Can I get rid of nodes without re-arrange nodeID?

Hi,

on graph.optimize( ).
I don’t care the trimSize() can save for node, because the node number is not too much.
But the inPlace switch bother me a lot.

I record the edge’s direction when I import data by baseNode < adjNode.
if the edge is backward, I will use -edgeID-1.
Otherwise, I just use edgeID.

Now, after the optimize( ), I find my direction is totally useless.

So, can I just remove the node, but without to change the nodeID?
just like what GH does for edge.

Is that possible?

What is the use case behind changing these internals?

Can I get rid of nodes without re-arrange nodeID?

No, you can’t. As the nodes and edge entries are stored adjacent.

Or do you mean you want to remove a node from being used in edges? That should be possible and you’ll get some gaps.

Hi Peter,

Some turn restriction is composed of more than 2 edges, like http://www.openstreetmap.org/relation/3505952

And I would record the edge list, to represent the direction, I use -edgeId-1 to represent the reverse direction.

Then I found after the node in-place switch and squeezing, the direction changes.

For edges, we don’t do squeezing. All the edges are kept, even though it’s removed by island finding.

For nodes, can I do the same thing? like mark an edge as deleted, but without really delete it.

Instead of this special case for the rare situation of such special turn restrictions I would add some more edges and model it appropriate (as part of a post-import process). This way the algorithms won’t need to know about this and in the future e.g. also CH and CH preparation won’t have a problem with this.

You can do the same for nodes but as the node IDs are kind of part of a public contract it is not good. E.g. iterating through all nodes is currently done via raw indices but e.g. iterating the edges is done via the AllEdgesIterator where we can skip certain (e.g. unused) edges

the direction changes

This can happen but as e.g. the FlagEncoder can (and should) take care of this when switching the flags you should be able to hook into this mechanism too.

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