Skip to content

Use edge keys consistently #2152

Closed

Description

@easbar

With #2150 we can now obtain edge keys from edge states and obtain a certain edge state from a graph using an edge key.

However, we use a second definition of edge keys that uses the baseNode<=adjNode relation instead of the storage direction to determine the edge key. This second kind is used by the edge-based routing algorithms as traversal Ids.

This is not a real problem, but certainly not ideal and using the same definition of the edge keys would be more consistent.

The task here would be to replace GHUtility#createEdgeKey(base, adj, edge, reverse) with the 'internal' edge keys we obtain via edgeState.getEdgeKey(). This includes removing TraversalMode#createTraversalId(base, adj, egde, reverse).

I think to do this we need to add graph.getEdgeKey(edgeId, adjNode) and/or change the first/lastOrigEdge fields of the edge-based CH shortcuts to first/lastOrigKey fields.

Some work towards this was done in #2146.

Activity

  1. easbar commented on Apr 28, 2021

    @easbar
    MemberAuthor

    Another place where we create edge keys is in EdgeBasedTarjanSCC. Currently we use

        public static int createEdgeKey(EdgeIteratorState edgeState, boolean reverse) {
            int edgeKey = edgeState.getEdge() << 1;
            if (edgeState.get(EdgeIteratorState.REVERSE_STATE) == !reverse)
                edgeKey++;
            return edgeKey;
        }

    We could change this to edgeState.getEdgeKey(), but how would we 'revert' the edge key then? Maybe we need to add edgeState.getReverseEdgeKey() for this. But then we still have the discrepancy that in the algorithms we use edge keys that are based on A<B and in Tarjan+edgeState we use edge keys that are based on the edge's storage direction.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions