Below is the syntax highlighted version of AdjMatrixGraph.java from §4.1 Undirected Graphs.

```/******************************************************************************
*  Execution:    java AdjMatrixGraph V E
*  Dependencies: StdOut.java
*
*  A graph, implemented using an adjacency matrix.
*  Parallel edges are disallowed; self-loops are allowd.
*
******************************************************************************/

import java.util.Iterator;
import java.util.NoSuchElementException;

private static final String NEWLINE = System.getProperty("line.separator");

private final int V;
private int E;

// empty graph with V vertices
if (V < 0) throw new IllegalArgumentException("Too few vertices");
this.V = V;
this.E = 0;
}

// random graph with V vertices and E edges
public AdjMatrixGraph(int V, int E) {
this(V);
if (E > (long) V*(V-1)/2 + V) throw new IllegalArgumentException("Too many edges");
if (E < 0)                    throw new IllegalArgumentException("Too few edges");

// can be inefficient
while (this.E != E) {
int v = StdRandom.uniformInt(V);
int w = StdRandom.uniformInt(V);
}
}

// number of vertices and edges
public int V() { return V; }
public int E() { return E; }

public void addEdge(int v, int w) {
}

// does the graph contain the edge v-w?
public boolean contains(int v, int w) {
}

// return list of neighbors of v
}

// support iteration over graph vertices
private class AdjIterator implements Iterator<Integer>, Iterable<Integer> {
private int v;
private int w = 0;

this.v = v;
}

public Iterator<Integer> iterator() {
return this;
}

public boolean hasNext() {
while (w < V) {
w++;
}
return false;
}

public Integer next() {
if (!hasNext()) {
throw new NoSuchElementException();
}
return w++;
}

public void remove()  {
throw new UnsupportedOperationException();
}
}

// string representation of Graph - takes quadratic time
public String toString() {
StringBuilder s = new StringBuilder();
s.append(V + " " + E + NEWLINE);
for (int v = 0; v < V; v++) {
s.append(v + ": ");
for (int w : adj(v)) {
s.append(w + " ");
}
s.append(NEWLINE);
}
return s.toString();
}

// test client
public static void main(String[] args) {
int V = Integer.parseInt(args[0]);
int E = Integer.parseInt(args[1]);