Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add flag or config object to algorithm constructors to be able to specify how algorithm objects are initialized #14

Open
SimonTC opened this issue Aug 8, 2020 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@SimonTC
Copy link

SimonTC commented Aug 8, 2020

As described in #13 the instantiation of all shortest path algorithms include adding all vertices to the distance and vertex color dictionaries.

There are two possible issues with this:

  1. In case of graphs with many vertices the initial looping over all the vertices in the graph could become rather expensive.
  2. When using the Distances dictionary it might be preferable if no distance is returned for an inaccessible vertex instead of a Double since that a) can lead to unnecessary extra logic on the callers side to make sure a vertex is accessible and b) can result in unnecessary looping in case the caller wants to do something with all the key-value pairs in the dictionary.

To be able to avoid this it should be possible to influence whether the dictionaries are populated on instantiation or not. This can be done either by adding a flag directly to the constructor or by using a config object with the flag as a property.

Using a config object instead of a single flag would make it easier for us to add more flags in the future if needed without breaking backwards compatibility, so I would propose we did it that way.

@KeRNeLith
Copy link
Owner

Having a "config" structure on construction would be great for evolution indeed. We should think about having multiple layer of config structure since some algorithm can share common setup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants