public void topo() {

		java.util.ArrayList<Vertex> s = new java.util.ArrayList<>();
		int numOfVertices = vertices.length;

		while (numOfVertices > 0) {
			int tempNumOfVertices = numOfVertices;
			Vertex noSuccessorVertex = noSuccessor();
			if (noSuccessorVertex != null) {
				for (int i = 0; i < vertices.length; i++) {
					if (vertices[i] != null
							&& vertices[i].getLabel() == noSuccessorVertex
									.getLabel()) {
						s.add(0, noSuccessorVertex);
						deleteVertex(i, vertices);
						numOfVertices--;
						break;
					}
				}
			} else {

				if (tempNumOfVertices == numOfVertices
						|| noSuccessorVertex == null) {
					System.out.println("There is a cycle");
					return;
				}
			}
		}
		CollectionsHelper.printCollection(s, "\n");
	}