- Sort Score
- Num 10 results
- Language All
Results 1 - 2 of 2 for hasCycle (0.05 seconds)
-
android/guava-tests/test/com/google/common/graph/GraphPropertiesTest.java
public void hasCycle_emptyGraph() { assertThat(hasCycle(directedGraph)).isFalse(); assertThat(hasCycle(undirectedGraph)).isFalse(); } @Test public void hasCycle_isolatedNodes() { for (MutableGraph<Integer> graph : graphsToTest) { graph.addNode(1); graph.addNode(2); } assertThat(hasCycle(directedGraph)).isFalse(); assertThat(hasCycle(undirectedGraph)).isFalse(); } @Test
Created: Fri Apr 03 12:43:13 GMT 2026 - Last Modified: Thu Dec 19 18:03:30 GMT 2024 - 6.4K bytes - Click Count (0) -
android/guava/src/com/google/common/graph/Graphs.java
* and ending with the same node. * * <p>This method will detect any non-empty cycle, including self-loops (a cycle of length 1). */ public static <N> boolean hasCycle(Graph<N> graph) { int numEdges = graph.edges().size(); if (numEdges == 0) { return false; // An edge-free graph is acyclic by definition. } if (!graph.isDirected() && numEdges >= graph.nodes().size()) {
Created: Fri Apr 03 12:43:13 GMT 2026 - Last Modified: Wed Mar 11 01:10:31 GMT 2026 - 24.4K bytes - Click Count (0)