@Override
	public void addEdge(int v, int w) throws InvalidEdgeException,
			SelfLoopExistsException, ParallelEdgeExistsException
	{
		// check for invalid edge
		if (v < 0 || v >= V() || w < 0 || w >= V())
			throw new InvalidEdgeException("Invalid edge : " + v + "-" + w);

		if (v == w)
			throw new SelfLoopExistsException("Self loops not allowed : " + v
					+ "-" + w);

		for (int a : adj[v])
			if (a == w)
				throw new ParallelEdgeExistsException(
						"Parallel edges not allowed : " + v + "-" + w);

		adj[v].add(w);
		E++;
	}