You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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
.The text was updated successfully, but these errors were encountered: