@SuppressWarnings("unchecked") public List<SplitComponent<V, E>> findAllSplitComponents( Graph<V, E> graph, SplitPair<V, E> splitPair) { List<E> coveredEdges = new ArrayList<E>(); List<SplitComponent<V, E>> ret = new ArrayList<SplitComponent<V, E>>(); V u = splitPair.getU(); V v = splitPair.getV(); // add edge List<E> edges = graph.edgeesBetween(u, v); for (E e : edges) { // TODO sta ako stvarno ima vise izmedju, da li ovako, ili ne moze...? SplitComponent<V, E> component = new SplitComponent<>(splitPair, graph); component.addVertex(v); component.addVertex(u); component.addEdge(e); coveredEdges.add(e); ret.add(component); } for (E e : graph.allEdges(u)) { if (coveredEdges.contains(e)) continue; SplitComponent<V, E> component = new SplitComponent<>(splitPair, graph); coveredEdges.add(e); component.addVertex(u); component.addEdge(e); V other = e.getDestination() == u ? e.getOrigin() : e.getDestination(); if (other == v) // just add split pair vertices and the edge{ continue; else { formSplitComponent(u, v, other, coveredEdges, new ArrayList<V>(), component, graph); } ret.add(component); } return ret; }