This implementation uses an adjacency-lists representation.
All operations take constant time (in the worst case) except
iterating over vertices and over the vertices adjacent from a given vertex, which takes
time proportional to the number of such vertices.
For additional documentation,
see Section 4.2 of
Algorithms, 4th Edition by Robert Sedgewick and Kevin Wayne.
This implementation uses an adjacency-lists representation. All operations take constant time (in the worst case) except iterating over vertices and over the vertices adjacent from a given vertex, which takes time proportional to the number of such vertices.
For additional documentation, see Section 4.2 of Algorithms, 4th Edition by Robert Sedgewick and Kevin Wayne.