public boolean isLoop() { return wrappedElement.isLoop(); } }
public boolean isLoop() { return wrappedElement.isLoop(); } }
/** * This iterator traverses all the maximal cliques in a graph. Each call to * {@link java.util.Iterator#next()} returns a maximal clique in the form of * list of nodes. This iterator does not support remove. * * @param graph * a graph, must not have loop edges * @return an iterator on the maximal cliques of {@code graph} * @throws IllegalArgumentException * if {@code graph} has loop edges * @complexity This iterator implements the Bron–Kerbosch algorithm. There * is no guarantee that each call to * {@link java.util.Iterator#next()} will run in polynomial * time. However, iterating over <em>all</em> the maximal * cliques is efficient in worst case sense. The whole iteration * takes O(3<sup><i>n</i>/3</sup>) time in the worst case and it * is known that a <i>n</i>-node graph has at most * 3<sup><i>n</i>/3</sup> maximal cliques. */ public static <T extends Node> Iterator<List<T>> getMaximalCliqueIterator( Graph graph) { for (Edge edge : graph.getEachEdge()) if (edge.isLoop()) throw new IllegalArgumentException( "The graph must not have loop edges"); return new BronKerboschIterator<T>(graph); }
/** * This iterator traverses all the maximal cliques in a graph. Each call to * {@link java.util.Iterator#next()} returns a maximal clique in the form of * list of nodes. This iterator does not support remove. * * @param graph * a graph, must not have loop edges * @return an iterator on the maximal cliques of {@code graph} * @throws IllegalArgumentException * if {@code graph} has loop edges * @complexity This iterator implements the Bron–Kerbosch algorithm. There * is no guarantee that each call to * {@link java.util.Iterator#next()} will run in polynomial * time. However, iterating over <em>all</em> the maximal * cliques is efficient in worst case sense. The whole iteration * takes O(3<sup><i>n</i>/3</sup>) time in the worst case and it * is known that a <i>n</i>-node graph has at most * 3<sup><i>n</i>/3</sup> maximal cliques. */ public static <T extends Node> Iterator<List<T>> getMaximalCliqueIterator( Graph graph) { for (Edge edge : graph.getEachEdge()) if (edge.isLoop()) throw new IllegalArgumentException( "The graph must not have loop edges"); return new BronKerboschIterator<T>(graph); }