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

Replace Lists with Iterables/Iterators #5

Open
gdiscry opened this issue Apr 8, 2011 · 0 comments
Open

Replace Lists with Iterables/Iterators #5

gdiscry opened this issue Apr 8, 2011 · 0 comments

Comments

@gdiscry
Copy link
Collaborator

gdiscry commented Apr 8, 2011

Using Lists for the vertex neighbors and for the messages puts some constraints on the structure of a vertex.

Wouldn't it be better to use instead an Iterable/Iterator type for that and let the subclass deals with which type of collection to use underneath? It is still possible to use a List internally when direct access to an index is necessary.

Use Case

A possible representation for a graph with weighted edges is to use a Map (or MultiMap) to store the neighbors of a Vertex, using the neighboring vertices as key and the weight of the edge as value. Right now, that means maintaining two collections side by side.

With the change, we only have to use Map.keys.

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

No branches or pull requests

1 participant