public static UndirectedEdge selectAppropriateEdge(Vertex vertex,
			Graph graph) {
		ArrayList<UndirectedEdge> connectedEdges = graph
				.getConnectedEdges(vertex);
		UndirectedEdge mandatory = null;
		if (!connectedEdges.isEmpty() && connectedEdges != null) {
			for (int i = 0; i < connectedEdges.size(); i++) {
				UndirectedEdge edge = connectedEdges.get(i);
				if (!edge.isVisited()) {
					edge.visit();
					if (GraphAlgorithms.isConnected(graph)) {
						return edge;
					} else {
						mandatory = edge;
						edge.unvisit();
					}
				}
			}
			if (mandatory != null) {
				mandatory.visit();
			}
		}
		if (GraphUtils.isIsolated(graph, vertex)) {
			graph.deleteVertex(vertex);
		}
		return mandatory;
	}