public FriendshipGraph<Friend> getStudentsAtTheCollege(String college) { UndirGraph<Friend> collegeSubgraph = new UndirGraph<Friend>(); int vCount = this.graph.numberOfVertices(); for (int i = 0; i < vCount; i++) { if (this.graph.vertexInfoOf(i).school.compareTo(college) == 0) collegeSubgraph.addVertex(this.graph.vertexInfoOf(i)); } vCount = collegeSubgraph.numberOfVertices(); for (int i = 0; i < vCount; i++) { int firstRootRef = this.graph.vertexNumberOf(collegeSubgraph.vertexInfoOf(i)); for (int j = 0; j < vCount; j++) { int secondRootRef = this.graph.vertexNumberOf(collegeSubgraph.vertexInfoOf(j)); if (this.graph.containsEdge(firstRootRef, new Neighbor(secondRootRef))) collegeSubgraph.addEdge(i, new Neighbor(j)); } } return new FriendshipGraph<Friend>(collegeSubgraph); }