Skip to content

Remove the GraphExtension interface #1772

Closed

Description

@easbar

I think this abstraction is not very helpful. So far there is only TurnCostExtension implementing it and the functionality is rather limited. In many (currently 6 in production and 26 in tests) cases we need to cast the extension to TurnCostExtension.

I can imagine all kinds of meta/additional data one likes to store for nodes/edges, but why would we use a GraphExtension for this ? Maybe we prefer a simple int[], use an independent DataAccess, fetch data from disk etc., this can easily be done by using the node/edge ids, I see no real advantage of storing the additionalNode/Edge field right in the graph and for example for TurnCostExtension we already use this field only to store a reference to another DataAccess.

Maybe I am missing something, but as far as I am concerned we can just keep the TurnCostExtension (without the interface) in BaseGraph (probably make it optional/can be null instead of using NoOpExtension).

Activity

  1. added this to the 1.0 milestone on Oct 29, 2019
  2. karussell commented on Oct 29, 2019

    @karussell
    Member

    Yes, we should definitely do this! Maybe before this I have to make this branch production ready that allows storing arbitrary key value pairs like OSM tags or translated road names etc https://github.com/graphhopper/graphhopper/commits/string_index

    Update: this would be also helpful for the branch move_tc_out_of_flag_encoder (#1775) and we could try if the following is possible:

    • instead of TurnCostAccess we make usage simple via:
      edgeIteratorState.setTurnCost(carTurnCostEnc, nextEdgeId, 10.0) // base->adj->nextEdgeId
    • we move tcFlags inside EdgeIteratorState (remove it e.g. in TurnWeighting and TurnCostAccess)
    • we should be able to remove entire TurnCostAccess
  3. changed the title [-]Remove the `GraphExtension` interface ?[/-] [+]Remove the `GraphExtension` interface[/+] on Nov 8, 2019
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

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions