Graph.java (source code)

= Graph.java
{c}

Online text: https://raw.githubusercontent.com/kevin-wayne/algs4/master/src/main/java/edu/princeton/cs/algs4/Graph.java

Authored accompanying software by Robert Sedgewick and Kevin Wayne, identified by the implementation bylines. The book publication year is 2011; copyright 2002–2025 is not an implementation publication date. Implementation locators refer to the inspected source file, not to the textbook pages.

Cited passages: Graph.java, class documentation and fields: vertex-indexed adjacency collections; addEdge: entries at both endpoints; Graph.java, class documentation: parallel edges and two-entry undirected self-loop convention; addEdge applies both insertions even when v equals w.