List<List<Integer>> traverse(Graph g)
	{
		int startVertex = 0;
		List<List<Integer>> connectedComponents = new ArrayList<List<Integer>>();
		
		while(startVertex != ALL_VISITED)
		{
			PriorityQueue<Integer> queue = new PriorityQueue<Integer>(g.vcount());
			queue.add(startVertex);
			
			List<Integer> connectedGraph = new ArrayList<Integer>();
			connectedGraph.add(startVertex);
			
			g.setMark(startVertex, VISITED_VERTEX);
			
			while(queue.size() > 0)
			{
				int vertex = queue.poll();
				for(int neighbor = g.first(vertex); neighbor < g.vcount(); neighbor = g.next(vertex, neighbor))
				{
					if(g.getMark(neighbor) == UNVISITED_VERTEX)
					{
						g.setMark(neighbor, VISITED_VERTEX);
						queue.add(neighbor);
						connectedGraph.add(neighbor);
					}
				}
			}
			
			connectedComponents.add(connectedGraph);
			startVertex = findUnvisitedVertex(g);
		}
		
		return connectedComponents;
	}