Graphs/Java/Adjacency Map Lite
From charlesreid1
Note: this implementation is more practical for a lightweight problem, such as a programming competition or coding challenge.
Graph class:
- Constructor: initializes list of vertices, list of edges
- Add vertex method (identified by integers)
- Add edge method (takes two integers)
Vertex class:
- Map of Vertex objects to Edge objects, to store connecting edges
- Integer (element/identifier)
- Method: get neighbors
- Method: get element
Edge class:
- List of Vertex objects
- (Optional) int array (element/identifier)
- Constructor: two vertices, set as endpoints
- Method: get endpoints
- Method: get element
Flags