target stringlengths 20 113k | src_fm stringlengths 11 86.3k | src_fm_fc stringlengths 21 86.4k | src_fm_fc_co stringlengths 30 86.4k | src_fm_fc_ms stringlengths 42 86.8k | src_fm_fc_ms_ff stringlengths 43 86.8k |
|---|---|---|---|---|---|
@Test public void testComplete() { final int size = 6; Graph<Object, DefaultEdge> g = new SimpleGraph<>(DefaultEdge.class); CompleteGraphGenerator<Object, DefaultEdge> completeGraphGenerator = new CompleteGraphGenerator<>(size); completeGraphGenerator.generateGraph(g, new ClassBasedVertexFactory<>(Object.class), null);... | @Override public Iterator<Set<V>> iterator() { lazyRun(); return allMaximalCliques.iterator(); } | BaseBronKerboschCliqueFinder implements MaximalCliqueEnumerationAlgorithm<V, E> { @Override public Iterator<Set<V>> iterator() { lazyRun(); return allMaximalCliques.iterator(); } } | BaseBronKerboschCliqueFinder implements MaximalCliqueEnumerationAlgorithm<V, E> { @Override public Iterator<Set<V>> iterator() { lazyRun(); return allMaximalCliques.iterator(); } BaseBronKerboschCliqueFinder(Graph<V, E> graph, long timeout, TimeUnit unit); } | BaseBronKerboschCliqueFinder implements MaximalCliqueEnumerationAlgorithm<V, E> { @Override public Iterator<Set<V>> iterator() { lazyRun(); return allMaximalCliques.iterator(); } BaseBronKerboschCliqueFinder(Graph<V, E> graph, long timeout, TimeUnit unit); @Override Iterator<Set<V>> iterator(); Iterator<Set<V>> maximum... | BaseBronKerboschCliqueFinder implements MaximalCliqueEnumerationAlgorithm<V, E> { @Override public Iterator<Set<V>> iterator() { lazyRun(); return allMaximalCliques.iterator(); } BaseBronKerboschCliqueFinder(Graph<V, E> graph, long timeout, TimeUnit unit); @Override Iterator<Set<V>> iterator(); Iterator<Set<V>> maximum... |
@Test public void testGraphWithoutEdges() throws UnsupportedEncodingException, ExportException { Graph<Integer, DefaultEdge> orig = new SimpleGraph<>(DefaultEdge.class); orig.addVertex(0); orig.addVertex(1); String res = exportGraph(orig, Graph6Sparse6Exporter.Format.SPARSE6); assertEquals(":A", res); } | @Override public void exportGraph(Graph<V, E> g, Writer writer) throws ExportException { GraphTests.requireUndirected(g); if(format == Format.GRAPH6 && !GraphTests.isSimple(g)) throw new ExportException("Graphs exported in graph6 format cannot contain loops or multiple edges."); List<V> vertices = new ArrayList<>(g.ver... | Graph6Sparse6Exporter implements GraphExporter<V, E> { @Override public void exportGraph(Graph<V, E> g, Writer writer) throws ExportException { GraphTests.requireUndirected(g); if(format == Format.GRAPH6 && !GraphTests.isSimple(g)) throw new ExportException("Graphs exported in graph6 format cannot contain loops or mult... | Graph6Sparse6Exporter implements GraphExporter<V, E> { @Override public void exportGraph(Graph<V, E> g, Writer writer) throws ExportException { GraphTests.requireUndirected(g); if(format == Format.GRAPH6 && !GraphTests.isSimple(g)) throw new ExportException("Graphs exported in graph6 format cannot contain loops or mult... | Graph6Sparse6Exporter implements GraphExporter<V, E> { @Override public void exportGraph(Graph<V, E> g, Writer writer) throws ExportException { GraphTests.requireUndirected(g); if(format == Format.GRAPH6 && !GraphTests.isSimple(g)) throw new ExportException("Graphs exported in graph6 format cannot contain loops or mult... | Graph6Sparse6Exporter implements GraphExporter<V, E> { @Override public void exportGraph(Graph<V, E> g, Writer writer) throws ExportException { GraphTests.requireUndirected(g); if(format == Format.GRAPH6 && !GraphTests.isSimple(g)) throw new ExportException("Graphs exported in graph6 format cannot contain loops or mult... |
@Test public void testPair() { Pair<String, Custom> p = Pair.of(CUSTOM, new Custom(1)); assertEquals(CUSTOM, p.getFirst()); assertNotEquals(ANOTHER, p.getFirst()); assertEquals(new Custom(1), p.getSecond()); assertNotEquals(new Custom(2), p.getSecond()); assertTrue(p.hasElement(CUSTOM)); assertFalse(p.hasElement(ANOTHE... | public Pair(A a, B b) { this.first = a; this.second = b; } | Pair implements Serializable { public Pair(A a, B b) { this.first = a; this.second = b; } } | Pair implements Serializable { public Pair(A a, B b) { this.first = a; this.second = b; } Pair(A a, B b); } | Pair implements Serializable { public Pair(A a, B b) { this.first = a; this.second = b; } Pair(A a, B b); A getFirst(); B getSecond(); boolean hasElement(E e); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode(); static Pair<A, B> of(A a, B b); } | Pair implements Serializable { public Pair(A a, B b) { this.first = a; this.second = b; } Pair(A a, B b); A getFirst(); B getSecond(); boolean hasElement(E e); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode(); static Pair<A, B> of(A a, B b); } |
@Test public void testPairEquals() { Pair<String, Custom> p1 = Pair.of(CUSTOM, new Custom(1)); Pair<String, Custom> p2 = Pair.of(ANOTHER, new Custom(1)); Pair<String, Custom> p3 = Pair.of(ANOTHER, new Custom(2)); Pair<String, Custom> p4 = Pair.of(CUSTOM, new Custom(1)); Pair<String, Custom> p5 = Pair.of(CUSTOM, new Cus... | public static <A, B> Pair<A, B> of(A a, B b) { return new Pair<>(a, b); } | Pair implements Serializable { public static <A, B> Pair<A, B> of(A a, B b) { return new Pair<>(a, b); } } | Pair implements Serializable { public static <A, B> Pair<A, B> of(A a, B b) { return new Pair<>(a, b); } Pair(A a, B b); } | Pair implements Serializable { public static <A, B> Pair<A, B> of(A a, B b) { return new Pair<>(a, b); } Pair(A a, B b); A getFirst(); B getSecond(); boolean hasElement(E e); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode(); static Pair<A, B> of(A a, B b); } | Pair implements Serializable { public static <A, B> Pair<A, B> of(A a, B b) { return new Pair<>(a, b); } Pair(A a, B b); A getFirst(); B getSecond(); boolean hasElement(E e); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode(); static Pair<A, B> of(A a, B b); } |
@Test public void testUnorderedPairEquals() { Pair<String, Custom> p1 = UnorderedPair.of(CUSTOM, new Custom(1)); Pair<String, Custom> p2 = UnorderedPair.of(ANOTHER, new Custom(1)); Pair<String, Custom> p3 = UnorderedPair.of(ANOTHER, new Custom(2)); Pair<String, Custom> p4 = UnorderedPair.of(CUSTOM, new Custom(1)); Pair... | public static <A, B> Pair<A, B> of(A a, B b) { return new Pair<>(a, b); } | Pair implements Serializable { public static <A, B> Pair<A, B> of(A a, B b) { return new Pair<>(a, b); } } | Pair implements Serializable { public static <A, B> Pair<A, B> of(A a, B b) { return new Pair<>(a, b); } Pair(A a, B b); } | Pair implements Serializable { public static <A, B> Pair<A, B> of(A a, B b) { return new Pair<>(a, b); } Pair(A a, B b); A getFirst(); B getSecond(); boolean hasElement(E e); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode(); static Pair<A, B> of(A a, B b); } | Pair implements Serializable { public static <A, B> Pair<A, B> of(A a, B b) { return new Pair<>(a, b); } Pair(A a, B b); A getFirst(); B getSecond(); boolean hasElement(E e); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode(); static Pair<A, B> of(A a, B b); } |
@Test public void testPairEqualsWithNull() { Pair<String, Custom> p1 = Pair.of(CUSTOM, null); Pair<Custom, String> p2 = Pair.of(null, CUSTOM); Pair<String, Custom> p3 = Pair.of(ANOTHER, null); Pair<String, Custom> p4 = Pair.of(CUSTOM, null); Pair<String, Custom> p5 = Pair.of(CUSTOM, new Custom(1)); assertNotEquals(p1, ... | public static <A, B> Pair<A, B> of(A a, B b) { return new Pair<>(a, b); } | Pair implements Serializable { public static <A, B> Pair<A, B> of(A a, B b) { return new Pair<>(a, b); } } | Pair implements Serializable { public static <A, B> Pair<A, B> of(A a, B b) { return new Pair<>(a, b); } Pair(A a, B b); } | Pair implements Serializable { public static <A, B> Pair<A, B> of(A a, B b) { return new Pair<>(a, b); } Pair(A a, B b); A getFirst(); B getSecond(); boolean hasElement(E e); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode(); static Pair<A, B> of(A a, B b); } | Pair implements Serializable { public static <A, B> Pair<A, B> of(A a, B b) { return new Pair<>(a, b); } Pair(A a, B b); A getFirst(); B getSecond(); boolean hasElement(E e); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode(); static Pair<A, B> of(A a, B b); } |
@Test public void testUnorderedPairEqualsWithNull() { Pair<String, Custom> p1 = UnorderedPair.of(CUSTOM, null); Pair<Custom, String> p2 = UnorderedPair.of(null, CUSTOM); Pair<String, Custom> p3 = UnorderedPair.of(ANOTHER, null); Pair<String, Custom> p4 = UnorderedPair.of(CUSTOM, null); Pair<String, Custom> p5 = Unorder... | public static <A, B> Pair<A, B> of(A a, B b) { return new Pair<>(a, b); } | Pair implements Serializable { public static <A, B> Pair<A, B> of(A a, B b) { return new Pair<>(a, b); } } | Pair implements Serializable { public static <A, B> Pair<A, B> of(A a, B b) { return new Pair<>(a, b); } Pair(A a, B b); } | Pair implements Serializable { public static <A, B> Pair<A, B> of(A a, B b) { return new Pair<>(a, b); } Pair(A a, B b); A getFirst(); B getSecond(); boolean hasElement(E e); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode(); static Pair<A, B> of(A a, B b); } | Pair implements Serializable { public static <A, B> Pair<A, B> of(A a, B b) { return new Pair<>(a, b); } Pair(A a, B b); A getFirst(); B getSecond(); boolean hasElement(E e); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode(); static Pair<A, B> of(A a, B b); } |
@Test public void testDifferentTypesEqualsWithNull() { Pair<String, Custom> p1 = Pair.of(null, null); Pair<String, Custom> p2 = Pair.of(null, null); Pair<Custom, String> p3 = Pair.of(null, null); assertEquals(p1, p2); assertEquals(p2, p3); assertEquals(p3, p1); UnorderedPair<String, Custom> p4 = UnorderedPair.of(null, ... | public static <A, B> Pair<A, B> of(A a, B b) { return new Pair<>(a, b); } | Pair implements Serializable { public static <A, B> Pair<A, B> of(A a, B b) { return new Pair<>(a, b); } } | Pair implements Serializable { public static <A, B> Pair<A, B> of(A a, B b) { return new Pair<>(a, b); } Pair(A a, B b); } | Pair implements Serializable { public static <A, B> Pair<A, B> of(A a, B b) { return new Pair<>(a, b); } Pair(A a, B b); A getFirst(); B getSecond(); boolean hasElement(E e); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode(); static Pair<A, B> of(A a, B b); } | Pair implements Serializable { public static <A, B> Pair<A, B> of(A a, B b) { return new Pair<>(a, b); } Pair(A a, B b); A getFirst(); B getSecond(); boolean hasElement(E e); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode(); static Pair<A, B> of(A a, B b); } |
@Test public void test1() { final long seed = 5; double[] prob = { 0.1, 0.2, 0.3, 0.4 }; AliasMethodSampler am = new AliasMethodSampler(prob, new Random(seed)); int[] counts = new int[4]; for (int i = 0; i < 1000000; i++) { counts[am.next()]++; } assertEquals(100033, counts[0]); assertEquals(200069, counts[1]); assertE... | public int next() { double u = rng.nextDouble() * prob.length; int j = (int) Math.floor(u); if (comparator.compare(u - j, prob[j]) <= 0) { return j; } else { return alias[j]; } } | AliasMethodSampler { public int next() { double u = rng.nextDouble() * prob.length; int j = (int) Math.floor(u); if (comparator.compare(u - j, prob[j]) <= 0) { return j; } else { return alias[j]; } } } | AliasMethodSampler { public int next() { double u = rng.nextDouble() * prob.length; int j = (int) Math.floor(u); if (comparator.compare(u - j, prob[j]) <= 0) { return j; } else { return alias[j]; } } AliasMethodSampler(double[] p); AliasMethodSampler(double[] p, long seed); AliasMethodSampler(double[] p, Random rng);... | AliasMethodSampler { public int next() { double u = rng.nextDouble() * prob.length; int j = (int) Math.floor(u); if (comparator.compare(u - j, prob[j]) <= 0) { return j; } else { return alias[j]; } } AliasMethodSampler(double[] p); AliasMethodSampler(double[] p, long seed); AliasMethodSampler(double[] p, Random rng);... | AliasMethodSampler { public int next() { double u = rng.nextDouble() * prob.length; int j = (int) Math.floor(u); if (comparator.compare(u - j, prob[j]) <= 0) { return j; } else { return alias[j]; } } AliasMethodSampler(double[] p); AliasMethodSampler(double[] p, long seed); AliasMethodSampler(double[] p, Random rng);... |
@Test public void test2() { final long seed = 17; double[] prob = { 0.05, 0.05, 0.05, 0.05, 0.8 }; AliasMethodSampler am = new AliasMethodSampler(prob, new Random(seed)); int[] counts = new int[5]; for (int i = 0; i < 1000000; i++) { counts[am.next()]++; } assertEquals(49949, counts[0]); assertEquals(49726, counts[1]);... | public int next() { double u = rng.nextDouble() * prob.length; int j = (int) Math.floor(u); if (comparator.compare(u - j, prob[j]) <= 0) { return j; } else { return alias[j]; } } | AliasMethodSampler { public int next() { double u = rng.nextDouble() * prob.length; int j = (int) Math.floor(u); if (comparator.compare(u - j, prob[j]) <= 0) { return j; } else { return alias[j]; } } } | AliasMethodSampler { public int next() { double u = rng.nextDouble() * prob.length; int j = (int) Math.floor(u); if (comparator.compare(u - j, prob[j]) <= 0) { return j; } else { return alias[j]; } } AliasMethodSampler(double[] p); AliasMethodSampler(double[] p, long seed); AliasMethodSampler(double[] p, Random rng);... | AliasMethodSampler { public int next() { double u = rng.nextDouble() * prob.length; int j = (int) Math.floor(u); if (comparator.compare(u - j, prob[j]) <= 0) { return j; } else { return alias[j]; } } AliasMethodSampler(double[] p); AliasMethodSampler(double[] p, long seed); AliasMethodSampler(double[] p, Random rng);... | AliasMethodSampler { public int next() { double u = rng.nextDouble() * prob.length; int j = (int) Math.floor(u); if (comparator.compare(u - j, prob[j]) <= 0) { return j; } else { return alias[j]; } } AliasMethodSampler(double[] p); AliasMethodSampler(double[] p, long seed); AliasMethodSampler(double[] p, Random rng);... |
@Test public void testNeighborSet() { ListenableGraph<String, Object> g = new DefaultListenableGraph<>(new SimpleGraph<>(Object.class)); NeighborCache<String, Object> cache = new NeighborCache<>(g); g.addGraphListener(cache); g.addVertex(V1); g.addVertex(V2); g.addEdge(V1, V2); Set<String> neighbors1 = cache.neighborsO... | public Set<V> neighborsOf(V v) { return fetch(v, neighbors, k -> new Neighbors<>(Graphs.neighborListOf(graph, v))); } | NeighborCache implements GraphListener<V, E> { public Set<V> neighborsOf(V v) { return fetch(v, neighbors, k -> new Neighbors<>(Graphs.neighborListOf(graph, v))); } } | NeighborCache implements GraphListener<V, E> { public Set<V> neighborsOf(V v) { return fetch(v, neighbors, k -> new Neighbors<>(Graphs.neighborListOf(graph, v))); } NeighborCache(Graph<V, E> graph); } | NeighborCache implements GraphListener<V, E> { public Set<V> neighborsOf(V v) { return fetch(v, neighbors, k -> new Neighbors<>(Graphs.neighborListOf(graph, v))); } NeighborCache(Graph<V, E> graph); Set<V> predecessorsOf(V v); Set<V> successorsOf(V v); Set<V> neighborsOf(V v); List<V> neighborListOf(V v); @Override voi... | NeighborCache implements GraphListener<V, E> { public Set<V> neighborsOf(V v) { return fetch(v, neighbors, k -> new Neighbors<>(Graphs.neighborListOf(graph, v))); } NeighborCache(Graph<V, E> graph); Set<V> predecessorsOf(V v); Set<V> successorsOf(V v); Set<V> neighborsOf(V v); List<V> neighborListOf(V v); @Override voi... |
@Test public void testVertexRemoval() { ListenableGraph<String, DefaultEdge> graph = new DefaultListenableGraph<>(new SimpleGraph<>(DefaultEdge.class)); final String A = "A"; final String B = "B"; final String C = "C"; final String D = "D"; NeighborCache<String, DefaultEdge> cache = new NeighborCache<>(graph); graph.ad... | public Set<V> neighborsOf(V v) { return fetch(v, neighbors, k -> new Neighbors<>(Graphs.neighborListOf(graph, v))); } | NeighborCache implements GraphListener<V, E> { public Set<V> neighborsOf(V v) { return fetch(v, neighbors, k -> new Neighbors<>(Graphs.neighborListOf(graph, v))); } } | NeighborCache implements GraphListener<V, E> { public Set<V> neighborsOf(V v) { return fetch(v, neighbors, k -> new Neighbors<>(Graphs.neighborListOf(graph, v))); } NeighborCache(Graph<V, E> graph); } | NeighborCache implements GraphListener<V, E> { public Set<V> neighborsOf(V v) { return fetch(v, neighbors, k -> new Neighbors<>(Graphs.neighborListOf(graph, v))); } NeighborCache(Graph<V, E> graph); Set<V> predecessorsOf(V v); Set<V> successorsOf(V v); Set<V> neighborsOf(V v); List<V> neighborListOf(V v); @Override voi... | NeighborCache implements GraphListener<V, E> { public Set<V> neighborsOf(V v) { return fetch(v, neighbors, k -> new Neighbors<>(Graphs.neighborListOf(graph, v))); } NeighborCache(Graph<V, E> graph); Set<V> predecessorsOf(V v); Set<V> successorsOf(V v); Set<V> neighborsOf(V v); List<V> neighborListOf(V v); @Override voi... |
@Test public void testExampleGraph() throws UnsupportedEncodingException, ExportException { Graph<Integer, DefaultEdge> orig = new SimpleGraph<>(DefaultEdge.class); Graphs.addAllVertices(orig, Arrays.asList(0,1,2,3,4,5,6)); orig.addEdge(0, 1); orig.addEdge(0, 2); orig.addEdge(1, 2); orig.addEdge(5,6); String res = expo... | @Override public void exportGraph(Graph<V, E> g, Writer writer) throws ExportException { GraphTests.requireUndirected(g); if(format == Format.GRAPH6 && !GraphTests.isSimple(g)) throw new ExportException("Graphs exported in graph6 format cannot contain loops or multiple edges."); List<V> vertices = new ArrayList<>(g.ver... | Graph6Sparse6Exporter implements GraphExporter<V, E> { @Override public void exportGraph(Graph<V, E> g, Writer writer) throws ExportException { GraphTests.requireUndirected(g); if(format == Format.GRAPH6 && !GraphTests.isSimple(g)) throw new ExportException("Graphs exported in graph6 format cannot contain loops or mult... | Graph6Sparse6Exporter implements GraphExporter<V, E> { @Override public void exportGraph(Graph<V, E> g, Writer writer) throws ExportException { GraphTests.requireUndirected(g); if(format == Format.GRAPH6 && !GraphTests.isSimple(g)) throw new ExportException("Graphs exported in graph6 format cannot contain loops or mult... | Graph6Sparse6Exporter implements GraphExporter<V, E> { @Override public void exportGraph(Graph<V, E> g, Writer writer) throws ExportException { GraphTests.requireUndirected(g); if(format == Format.GRAPH6 && !GraphTests.isSimple(g)) throw new ExportException("Graphs exported in graph6 format cannot contain loops or mult... | Graph6Sparse6Exporter implements GraphExporter<V, E> { @Override public void exportGraph(Graph<V, E> g, Writer writer) throws ExportException { GraphTests.requireUndirected(g); if(format == Format.GRAPH6 && !GraphTests.isSimple(g)) throw new ExportException("Graphs exported in graph6 format cannot contain loops or mult... |
@Test public void testNeighborListCreation() { ListenableGraph<String, DefaultEdge> graph = new DefaultListenableGraph<>(new SimpleGraph<>(DefaultEdge.class)); final String A = "A"; final String B = "B"; final String C = "C"; final String D = "D"; NeighborCache<String, DefaultEdge> cache = new NeighborCache<>(graph); g... | public List<V> neighborListOf(V v) { Neighbors<V> nbrs = neighbors.get(v); if (nbrs == null) { nbrs = new Neighbors<>(Graphs.neighborListOf(graph, v)); neighbors.put(v, nbrs); } return nbrs.getNeighborList(); } | NeighborCache implements GraphListener<V, E> { public List<V> neighborListOf(V v) { Neighbors<V> nbrs = neighbors.get(v); if (nbrs == null) { nbrs = new Neighbors<>(Graphs.neighborListOf(graph, v)); neighbors.put(v, nbrs); } return nbrs.getNeighborList(); } } | NeighborCache implements GraphListener<V, E> { public List<V> neighborListOf(V v) { Neighbors<V> nbrs = neighbors.get(v); if (nbrs == null) { nbrs = new Neighbors<>(Graphs.neighborListOf(graph, v)); neighbors.put(v, nbrs); } return nbrs.getNeighborList(); } NeighborCache(Graph<V, E> graph); } | NeighborCache implements GraphListener<V, E> { public List<V> neighborListOf(V v) { Neighbors<V> nbrs = neighbors.get(v); if (nbrs == null) { nbrs = new Neighbors<>(Graphs.neighborListOf(graph, v)); neighbors.put(v, nbrs); } return nbrs.getNeighborList(); } NeighborCache(Graph<V, E> graph); Set<V> predecessorsOf(V v); ... | NeighborCache implements GraphListener<V, E> { public List<V> neighborListOf(V v) { Neighbors<V> nbrs = neighbors.get(v); if (nbrs == null) { nbrs = new Neighbors<>(Graphs.neighborListOf(graph, v)); neighbors.put(v, nbrs); } return nbrs.getNeighborList(); } NeighborCache(Graph<V, E> graph); Set<V> predecessorsOf(V v); ... |
@Test public void testBinaryTree() { Graph<String, DefaultEdge> g = new DefaultDirectedGraph<>(DefaultEdge.class); g.addVertex("a"); g.addVertex("b"); g.addVertex("c"); g.addVertex("d"); g.addVertex("e"); g.addEdge("a", "b"); g.addEdge("b", "c"); g.addEdge("b", "d"); g.addEdge("d", "e"); Assert.assertEquals("b", new Ta... | public V calculate(V start, V a, V b) { List<LcaRequestResponse<V>> list = new LinkedList<>(); list.add(new LcaRequestResponse<>(a, b)); return calculate(start, list).get(0); } | TarjanLowestCommonAncestor { public V calculate(V start, V a, V b) { List<LcaRequestResponse<V>> list = new LinkedList<>(); list.add(new LcaRequestResponse<>(a, b)); return calculate(start, list).get(0); } } | TarjanLowestCommonAncestor { public V calculate(V start, V a, V b) { List<LcaRequestResponse<V>> list = new LinkedList<>(); list.add(new LcaRequestResponse<>(a, b)); return calculate(start, list).get(0); } TarjanLowestCommonAncestor(Graph<V, E> g); } | TarjanLowestCommonAncestor { public V calculate(V start, V a, V b) { List<LcaRequestResponse<V>> list = new LinkedList<>(); list.add(new LcaRequestResponse<>(a, b)); return calculate(start, list).get(0); } TarjanLowestCommonAncestor(Graph<V, E> g); V calculate(V start, V a, V b); List<V> calculate(V start, List<LcaRequ... | TarjanLowestCommonAncestor { public V calculate(V start, V a, V b) { List<LcaRequestResponse<V>> list = new LinkedList<>(); list.add(new LcaRequestResponse<>(a, b)); return calculate(start, list).get(0); } TarjanLowestCommonAncestor(Graph<V, E> g); V calculate(V start, V a, V b); List<V> calculate(V start, List<LcaRequ... |
@Test public void testNonBinaryTree() { Graph<String, DefaultEdge> g = new DefaultDirectedGraph<>(DefaultEdge.class); g.addVertex("a"); g.addVertex("b"); g.addVertex("c"); g.addVertex("d"); g.addVertex("e"); g.addVertex("f"); g.addVertex("g"); g.addVertex("h"); g.addVertex("i"); g.addVertex("j"); g.addEdge("a", "b"); g... | public V calculate(V start, V a, V b) { List<LcaRequestResponse<V>> list = new LinkedList<>(); list.add(new LcaRequestResponse<>(a, b)); return calculate(start, list).get(0); } | TarjanLowestCommonAncestor { public V calculate(V start, V a, V b) { List<LcaRequestResponse<V>> list = new LinkedList<>(); list.add(new LcaRequestResponse<>(a, b)); return calculate(start, list).get(0); } } | TarjanLowestCommonAncestor { public V calculate(V start, V a, V b) { List<LcaRequestResponse<V>> list = new LinkedList<>(); list.add(new LcaRequestResponse<>(a, b)); return calculate(start, list).get(0); } TarjanLowestCommonAncestor(Graph<V, E> g); } | TarjanLowestCommonAncestor { public V calculate(V start, V a, V b) { List<LcaRequestResponse<V>> list = new LinkedList<>(); list.add(new LcaRequestResponse<>(a, b)); return calculate(start, list).get(0); } TarjanLowestCommonAncestor(Graph<V, E> g); V calculate(V start, V a, V b); List<V> calculate(V start, List<LcaRequ... | TarjanLowestCommonAncestor { public V calculate(V start, V a, V b) { List<LcaRequestResponse<V>> list = new LinkedList<>(); list.add(new LcaRequestResponse<>(a, b)); return calculate(start, list).get(0); } TarjanLowestCommonAncestor(Graph<V, E> g); V calculate(V start, V a, V b); List<V> calculate(V start, List<LcaRequ... |
@Test public void testOneNode() { Graph<String, DefaultEdge> g = new DefaultDirectedGraph<>(DefaultEdge.class); g.addVertex("a"); Assert.assertEquals("a", new TarjanLowestCommonAncestor<>(g).calculate("a", "a", "a")); } | public V calculate(V start, V a, V b) { List<LcaRequestResponse<V>> list = new LinkedList<>(); list.add(new LcaRequestResponse<>(a, b)); return calculate(start, list).get(0); } | TarjanLowestCommonAncestor { public V calculate(V start, V a, V b) { List<LcaRequestResponse<V>> list = new LinkedList<>(); list.add(new LcaRequestResponse<>(a, b)); return calculate(start, list).get(0); } } | TarjanLowestCommonAncestor { public V calculate(V start, V a, V b) { List<LcaRequestResponse<V>> list = new LinkedList<>(); list.add(new LcaRequestResponse<>(a, b)); return calculate(start, list).get(0); } TarjanLowestCommonAncestor(Graph<V, E> g); } | TarjanLowestCommonAncestor { public V calculate(V start, V a, V b) { List<LcaRequestResponse<V>> list = new LinkedList<>(); list.add(new LcaRequestResponse<>(a, b)); return calculate(start, list).get(0); } TarjanLowestCommonAncestor(Graph<V, E> g); V calculate(V start, V a, V b); List<V> calculate(V start, List<LcaRequ... | TarjanLowestCommonAncestor { public V calculate(V start, V a, V b) { List<LcaRequestResponse<V>> list = new LinkedList<>(); list.add(new LcaRequestResponse<>(a, b)); return calculate(start, list).get(0); } TarjanLowestCommonAncestor(Graph<V, E> g); V calculate(V start, V a, V b); List<V> calculate(V start, List<LcaRequ... |
@Test public void testForEmptyGraph() { Graph<V, WeightedEdge> graph = new SimpleWeightedGraph<>(WeightedEdge.class); Set<? extends V> emptyList = Collections.emptySet(); MatchingAlgorithm<V, WeightedEdge> alg = new KuhnMunkresMinimalWeightBipartitePerfectMatching<>(graph, emptyList, emptyList); Assert.assertTrue(alg.g... | @Override public Matching<V, E> getMatching() { if (partition1.size() != partition2.size()) { throw new IllegalArgumentException( "Graph supplied isn't complete bipartite with equally sized partitions!"); } if (!GraphTests.isBipartitePartition(graph, partition1, partition2)) { throw new IllegalArgumentException("Invali... | KuhnMunkresMinimalWeightBipartitePerfectMatching implements MatchingAlgorithm<V, E> { @Override public Matching<V, E> getMatching() { if (partition1.size() != partition2.size()) { throw new IllegalArgumentException( "Graph supplied isn't complete bipartite with equally sized partitions!"); } if (!GraphTests.isBipartite... | KuhnMunkresMinimalWeightBipartitePerfectMatching implements MatchingAlgorithm<V, E> { @Override public Matching<V, E> getMatching() { if (partition1.size() != partition2.size()) { throw new IllegalArgumentException( "Graph supplied isn't complete bipartite with equally sized partitions!"); } if (!GraphTests.isBipartite... | KuhnMunkresMinimalWeightBipartitePerfectMatching implements MatchingAlgorithm<V, E> { @Override public Matching<V, E> getMatching() { if (partition1.size() != partition2.size()) { throw new IllegalArgumentException( "Graph supplied isn't complete bipartite with equally sized partitions!"); } if (!GraphTests.isBipartite... | KuhnMunkresMinimalWeightBipartitePerfectMatching implements MatchingAlgorithm<V, E> { @Override public Matching<V, E> getMatching() { if (partition1.size() != partition2.size()) { throw new IllegalArgumentException( "Graph supplied isn't complete bipartite with equally sized partitions!"); } if (!GraphTests.isBipartite... |
@Test public void maximumWeightBipartiteMatching1() { DefaultWeightedEdge e1 = graph.addEdge("s1", "t1"); graph.setEdgeWeight(e1, 1); matcher = new MaximumWeightBipartiteMatching<>(graph, partition1, partition2); Matching<String, DefaultWeightedEdge> matchings = matcher.getMatching(); assertEquals(1, matchings.getEdges... | @Override public Matching<V, E> getMatching() { if (!GraphTests.isSimple(graph)) { throw new IllegalArgumentException("Only simple graphs supported"); } if (!GraphTests.isBipartitePartition(graph, partition1, partition2)) { throw new IllegalArgumentException("Graph partition is not bipartite"); } this.vertexWeights = n... | MaximumWeightBipartiteMatching implements MatchingAlgorithm<V, E> { @Override public Matching<V, E> getMatching() { if (!GraphTests.isSimple(graph)) { throw new IllegalArgumentException("Only simple graphs supported"); } if (!GraphTests.isBipartitePartition(graph, partition1, partition2)) { throw new IllegalArgumentExc... | MaximumWeightBipartiteMatching implements MatchingAlgorithm<V, E> { @Override public Matching<V, E> getMatching() { if (!GraphTests.isSimple(graph)) { throw new IllegalArgumentException("Only simple graphs supported"); } if (!GraphTests.isBipartitePartition(graph, partition1, partition2)) { throw new IllegalArgumentExc... | MaximumWeightBipartiteMatching implements MatchingAlgorithm<V, E> { @Override public Matching<V, E> getMatching() { if (!GraphTests.isSimple(graph)) { throw new IllegalArgumentException("Only simple graphs supported"); } if (!GraphTests.isBipartitePartition(graph, partition1, partition2)) { throw new IllegalArgumentExc... | MaximumWeightBipartiteMatching implements MatchingAlgorithm<V, E> { @Override public Matching<V, E> getMatching() { if (!GraphTests.isSimple(graph)) { throw new IllegalArgumentException("Only simple graphs supported"); } if (!GraphTests.isBipartitePartition(graph, partition1, partition2)) { throw new IllegalArgumentExc... |
@Test public void maximumWeightBipartiteMatching2() { DefaultWeightedEdge e1 = graph.addEdge("s1", "t1"); graph.setEdgeWeight(e1, 1); DefaultWeightedEdge e2 = graph.addEdge("s2", "t1"); graph.setEdgeWeight(e2, 2); matcher = new MaximumWeightBipartiteMatching<>(graph, partition1, partition2); Matching<String, DefaultWei... | @Override public Matching<V, E> getMatching() { if (!GraphTests.isSimple(graph)) { throw new IllegalArgumentException("Only simple graphs supported"); } if (!GraphTests.isBipartitePartition(graph, partition1, partition2)) { throw new IllegalArgumentException("Graph partition is not bipartite"); } this.vertexWeights = n... | MaximumWeightBipartiteMatching implements MatchingAlgorithm<V, E> { @Override public Matching<V, E> getMatching() { if (!GraphTests.isSimple(graph)) { throw new IllegalArgumentException("Only simple graphs supported"); } if (!GraphTests.isBipartitePartition(graph, partition1, partition2)) { throw new IllegalArgumentExc... | MaximumWeightBipartiteMatching implements MatchingAlgorithm<V, E> { @Override public Matching<V, E> getMatching() { if (!GraphTests.isSimple(graph)) { throw new IllegalArgumentException("Only simple graphs supported"); } if (!GraphTests.isBipartitePartition(graph, partition1, partition2)) { throw new IllegalArgumentExc... | MaximumWeightBipartiteMatching implements MatchingAlgorithm<V, E> { @Override public Matching<V, E> getMatching() { if (!GraphTests.isSimple(graph)) { throw new IllegalArgumentException("Only simple graphs supported"); } if (!GraphTests.isBipartitePartition(graph, partition1, partition2)) { throw new IllegalArgumentExc... | MaximumWeightBipartiteMatching implements MatchingAlgorithm<V, E> { @Override public Matching<V, E> getMatching() { if (!GraphTests.isSimple(graph)) { throw new IllegalArgumentException("Only simple graphs supported"); } if (!GraphTests.isBipartitePartition(graph, partition1, partition2)) { throw new IllegalArgumentExc... |
@Test public void maximumWeightBipartiteMatching3() { DefaultWeightedEdge e1 = graph.addEdge("s1", "t1"); graph.setEdgeWeight(e1, 2); DefaultWeightedEdge e2 = graph.addEdge("s1", "t2"); graph.setEdgeWeight(e2, 1); DefaultWeightedEdge e3 = graph.addEdge("s2", "t1"); graph.setEdgeWeight(e3, 2); matcher = new MaximumWeigh... | @Override public Matching<V, E> getMatching() { if (!GraphTests.isSimple(graph)) { throw new IllegalArgumentException("Only simple graphs supported"); } if (!GraphTests.isBipartitePartition(graph, partition1, partition2)) { throw new IllegalArgumentException("Graph partition is not bipartite"); } this.vertexWeights = n... | MaximumWeightBipartiteMatching implements MatchingAlgorithm<V, E> { @Override public Matching<V, E> getMatching() { if (!GraphTests.isSimple(graph)) { throw new IllegalArgumentException("Only simple graphs supported"); } if (!GraphTests.isBipartitePartition(graph, partition1, partition2)) { throw new IllegalArgumentExc... | MaximumWeightBipartiteMatching implements MatchingAlgorithm<V, E> { @Override public Matching<V, E> getMatching() { if (!GraphTests.isSimple(graph)) { throw new IllegalArgumentException("Only simple graphs supported"); } if (!GraphTests.isBipartitePartition(graph, partition1, partition2)) { throw new IllegalArgumentExc... | MaximumWeightBipartiteMatching implements MatchingAlgorithm<V, E> { @Override public Matching<V, E> getMatching() { if (!GraphTests.isSimple(graph)) { throw new IllegalArgumentException("Only simple graphs supported"); } if (!GraphTests.isBipartitePartition(graph, partition1, partition2)) { throw new IllegalArgumentExc... | MaximumWeightBipartiteMatching implements MatchingAlgorithm<V, E> { @Override public Matching<V, E> getMatching() { if (!GraphTests.isSimple(graph)) { throw new IllegalArgumentException("Only simple graphs supported"); } if (!GraphTests.isBipartitePartition(graph, partition1, partition2)) { throw new IllegalArgumentExc... |
@Test public void maximumWeightBipartiteMatching4() { DefaultWeightedEdge e1 = graph.addEdge("s1", "t1"); graph.setEdgeWeight(e1, 1); DefaultWeightedEdge e2 = graph.addEdge("s1", "t2"); graph.setEdgeWeight(e2, 1); DefaultWeightedEdge e3 = graph.addEdge("s2", "t2"); graph.setEdgeWeight(e3, 1); matcher = new MaximumWeigh... | @Override public Matching<V, E> getMatching() { if (!GraphTests.isSimple(graph)) { throw new IllegalArgumentException("Only simple graphs supported"); } if (!GraphTests.isBipartitePartition(graph, partition1, partition2)) { throw new IllegalArgumentException("Graph partition is not bipartite"); } this.vertexWeights = n... | MaximumWeightBipartiteMatching implements MatchingAlgorithm<V, E> { @Override public Matching<V, E> getMatching() { if (!GraphTests.isSimple(graph)) { throw new IllegalArgumentException("Only simple graphs supported"); } if (!GraphTests.isBipartitePartition(graph, partition1, partition2)) { throw new IllegalArgumentExc... | MaximumWeightBipartiteMatching implements MatchingAlgorithm<V, E> { @Override public Matching<V, E> getMatching() { if (!GraphTests.isSimple(graph)) { throw new IllegalArgumentException("Only simple graphs supported"); } if (!GraphTests.isBipartitePartition(graph, partition1, partition2)) { throw new IllegalArgumentExc... | MaximumWeightBipartiteMatching implements MatchingAlgorithm<V, E> { @Override public Matching<V, E> getMatching() { if (!GraphTests.isSimple(graph)) { throw new IllegalArgumentException("Only simple graphs supported"); } if (!GraphTests.isBipartitePartition(graph, partition1, partition2)) { throw new IllegalArgumentExc... | MaximumWeightBipartiteMatching implements MatchingAlgorithm<V, E> { @Override public Matching<V, E> getMatching() { if (!GraphTests.isSimple(graph)) { throw new IllegalArgumentException("Only simple graphs supported"); } if (!GraphTests.isBipartitePartition(graph, partition1, partition2)) { throw new IllegalArgumentExc... |
@Test public void maximumWeightBipartiteMatching5() { DefaultWeightedEdge e1 = graph.addEdge("s1", "t1"); graph.setEdgeWeight(e1, 1); DefaultWeightedEdge e2 = graph.addEdge("s1", "t2"); graph.setEdgeWeight(e2, 2); DefaultWeightedEdge e3 = graph.addEdge("s2", "t2"); graph.setEdgeWeight(e3, 2); DefaultWeightedEdge e4 = g... | @Override public Matching<V, E> getMatching() { if (!GraphTests.isSimple(graph)) { throw new IllegalArgumentException("Only simple graphs supported"); } if (!GraphTests.isBipartitePartition(graph, partition1, partition2)) { throw new IllegalArgumentException("Graph partition is not bipartite"); } this.vertexWeights = n... | MaximumWeightBipartiteMatching implements MatchingAlgorithm<V, E> { @Override public Matching<V, E> getMatching() { if (!GraphTests.isSimple(graph)) { throw new IllegalArgumentException("Only simple graphs supported"); } if (!GraphTests.isBipartitePartition(graph, partition1, partition2)) { throw new IllegalArgumentExc... | MaximumWeightBipartiteMatching implements MatchingAlgorithm<V, E> { @Override public Matching<V, E> getMatching() { if (!GraphTests.isSimple(graph)) { throw new IllegalArgumentException("Only simple graphs supported"); } if (!GraphTests.isBipartitePartition(graph, partition1, partition2)) { throw new IllegalArgumentExc... | MaximumWeightBipartiteMatching implements MatchingAlgorithm<V, E> { @Override public Matching<V, E> getMatching() { if (!GraphTests.isSimple(graph)) { throw new IllegalArgumentException("Only simple graphs supported"); } if (!GraphTests.isBipartitePartition(graph, partition1, partition2)) { throw new IllegalArgumentExc... | MaximumWeightBipartiteMatching implements MatchingAlgorithm<V, E> { @Override public Matching<V, E> getMatching() { if (!GraphTests.isSimple(graph)) { throw new IllegalArgumentException("Only simple graphs supported"); } if (!GraphTests.isBipartitePartition(graph, partition1, partition2)) { throw new IllegalArgumentExc... |
@Test public void testGraph1a() throws UnsupportedEncodingException, ExportException, ImportException { Graph<Integer, DefaultEdge> orig= NamedGraphGenerator.petersenGraph(); String res = exportGraph(orig, Graph6Sparse6Exporter.Format.SPARSE6); Graph<Integer, DefaultEdge> g = importGraph(res); this.compare(orig, g); } | @Override public void exportGraph(Graph<V, E> g, Writer writer) throws ExportException { GraphTests.requireUndirected(g); if(format == Format.GRAPH6 && !GraphTests.isSimple(g)) throw new ExportException("Graphs exported in graph6 format cannot contain loops or multiple edges."); List<V> vertices = new ArrayList<>(g.ver... | Graph6Sparse6Exporter implements GraphExporter<V, E> { @Override public void exportGraph(Graph<V, E> g, Writer writer) throws ExportException { GraphTests.requireUndirected(g); if(format == Format.GRAPH6 && !GraphTests.isSimple(g)) throw new ExportException("Graphs exported in graph6 format cannot contain loops or mult... | Graph6Sparse6Exporter implements GraphExporter<V, E> { @Override public void exportGraph(Graph<V, E> g, Writer writer) throws ExportException { GraphTests.requireUndirected(g); if(format == Format.GRAPH6 && !GraphTests.isSimple(g)) throw new ExportException("Graphs exported in graph6 format cannot contain loops or mult... | Graph6Sparse6Exporter implements GraphExporter<V, E> { @Override public void exportGraph(Graph<V, E> g, Writer writer) throws ExportException { GraphTests.requireUndirected(g); if(format == Format.GRAPH6 && !GraphTests.isSimple(g)) throw new ExportException("Graphs exported in graph6 format cannot contain loops or mult... | Graph6Sparse6Exporter implements GraphExporter<V, E> { @Override public void exportGraph(Graph<V, E> g, Writer writer) throws ExportException { GraphTests.requireUndirected(g); if(format == Format.GRAPH6 && !GraphTests.isSimple(g)) throw new ExportException("Graphs exported in graph6 format cannot contain loops or mult... |
@Test public void testNormalCases() { SimpleDirectedGraph<String, DefaultEdge> g = new SimpleDirectedGraph<>(DefaultEdge.class); g.addVertex("a"); g.addVertex("b"); g.addVertex("c"); g.addVertex("d"); g.addVertex("e"); g.addVertex("f"); g.addVertex("g"); g.addVertex("h"); g.addEdge("a", "b"); g.addEdge("b", "c"); g.add... | public V findLca(V a, V b) { return findLca( Collections.singleton(a), Collections.singleton(b), new LinkedHashSet<>(), new LinkedHashSet<>()); } | NaiveLcaFinder { public V findLca(V a, V b) { return findLca( Collections.singleton(a), Collections.singleton(b), new LinkedHashSet<>(), new LinkedHashSet<>()); } } | NaiveLcaFinder { public V findLca(V a, V b) { return findLca( Collections.singleton(a), Collections.singleton(b), new LinkedHashSet<>(), new LinkedHashSet<>()); } NaiveLcaFinder(Graph<V, E> graph); } | NaiveLcaFinder { public V findLca(V a, V b) { return findLca( Collections.singleton(a), Collections.singleton(b), new LinkedHashSet<>(), new LinkedHashSet<>()); } NaiveLcaFinder(Graph<V, E> graph); V findLca(V a, V b); Set<V> findLcas(V a, V b); } | NaiveLcaFinder { public V findLca(V a, V b) { return findLca( Collections.singleton(a), Collections.singleton(b), new LinkedHashSet<>(), new LinkedHashSet<>()); } NaiveLcaFinder(Graph<V, E> graph); V findLca(V a, V b); Set<V> findLcas(V a, V b); } |
@Test public void testNoLca() { SimpleDirectedGraph<String, DefaultEdge> g = new SimpleDirectedGraph<>(DefaultEdge.class); g.addVertex("a"); g.addVertex("b"); g.addVertex("c"); g.addVertex("d"); g.addVertex("e"); g.addVertex("f"); g.addVertex("g"); g.addVertex("h"); g.addVertex("i"); g.addEdge("a", "b"); g.addEdge("b",... | public V findLca(V a, V b) { return findLca( Collections.singleton(a), Collections.singleton(b), new LinkedHashSet<>(), new LinkedHashSet<>()); } | NaiveLcaFinder { public V findLca(V a, V b) { return findLca( Collections.singleton(a), Collections.singleton(b), new LinkedHashSet<>(), new LinkedHashSet<>()); } } | NaiveLcaFinder { public V findLca(V a, V b) { return findLca( Collections.singleton(a), Collections.singleton(b), new LinkedHashSet<>(), new LinkedHashSet<>()); } NaiveLcaFinder(Graph<V, E> graph); } | NaiveLcaFinder { public V findLca(V a, V b) { return findLca( Collections.singleton(a), Collections.singleton(b), new LinkedHashSet<>(), new LinkedHashSet<>()); } NaiveLcaFinder(Graph<V, E> graph); V findLca(V a, V b); Set<V> findLcas(V a, V b); } | NaiveLcaFinder { public V findLca(V a, V b) { return findLca( Collections.singleton(a), Collections.singleton(b), new LinkedHashSet<>(), new LinkedHashSet<>()); } NaiveLcaFinder(Graph<V, E> graph); V findLca(V a, V b); Set<V> findLcas(V a, V b); } |
@Test public void testLoops() { Graph<String, DefaultEdge> g = new DefaultDirectedGraph<>(DefaultEdge.class); g.addVertex("a"); g.addVertex("b"); g.addVertex("c"); g.addVertex("d"); g.addVertex("e"); g.addVertex("f"); g.addVertex("g"); g.addVertex("h"); g.addVertex("i"); g.addEdge("a", "b"); g.addEdge("b", "c"); g.addE... | public V findLca(V a, V b) { return findLca( Collections.singleton(a), Collections.singleton(b), new LinkedHashSet<>(), new LinkedHashSet<>()); } | NaiveLcaFinder { public V findLca(V a, V b) { return findLca( Collections.singleton(a), Collections.singleton(b), new LinkedHashSet<>(), new LinkedHashSet<>()); } } | NaiveLcaFinder { public V findLca(V a, V b) { return findLca( Collections.singleton(a), Collections.singleton(b), new LinkedHashSet<>(), new LinkedHashSet<>()); } NaiveLcaFinder(Graph<V, E> graph); } | NaiveLcaFinder { public V findLca(V a, V b) { return findLca( Collections.singleton(a), Collections.singleton(b), new LinkedHashSet<>(), new LinkedHashSet<>()); } NaiveLcaFinder(Graph<V, E> graph); V findLca(V a, V b); Set<V> findLcas(V a, V b); } | NaiveLcaFinder { public V findLca(V a, V b) { return findLca( Collections.singleton(a), Collections.singleton(b), new LinkedHashSet<>(), new LinkedHashSet<>()); } NaiveLcaFinder(Graph<V, E> graph); V findLca(V a, V b); Set<V> findLcas(V a, V b); } |
@Test public void testArrivalOrder() { Graph<String, DefaultEdge> g = new DefaultDirectedGraph<>(DefaultEdge.class); g.addVertex("a"); g.addVertex("b"); g.addVertex("c"); g.addVertex("g"); g.addVertex("e"); g.addVertex("h"); g.addEdge("a", "b"); g.addEdge("b", "c"); g.addEdge("a", "g"); g.addEdge("b", "g"); g.addEdge("... | public V findLca(V a, V b) { return findLca( Collections.singleton(a), Collections.singleton(b), new LinkedHashSet<>(), new LinkedHashSet<>()); } | NaiveLcaFinder { public V findLca(V a, V b) { return findLca( Collections.singleton(a), Collections.singleton(b), new LinkedHashSet<>(), new LinkedHashSet<>()); } } | NaiveLcaFinder { public V findLca(V a, V b) { return findLca( Collections.singleton(a), Collections.singleton(b), new LinkedHashSet<>(), new LinkedHashSet<>()); } NaiveLcaFinder(Graph<V, E> graph); } | NaiveLcaFinder { public V findLca(V a, V b) { return findLca( Collections.singleton(a), Collections.singleton(b), new LinkedHashSet<>(), new LinkedHashSet<>()); } NaiveLcaFinder(Graph<V, E> graph); V findLca(V a, V b); Set<V> findLcas(V a, V b); } | NaiveLcaFinder { public V findLca(V a, V b) { return findLca( Collections.singleton(a), Collections.singleton(b), new LinkedHashSet<>(), new LinkedHashSet<>()); } NaiveLcaFinder(Graph<V, E> graph); V findLca(V a, V b); Set<V> findLcas(V a, V b); } |
@Test public void testAutomorphism() { SimpleGraph<String, DefaultEdge> g1 = new SimpleGraph<>(DefaultEdge.class); String v1 = "v1", v2 = "v2", v3 = "v3"; g1.addVertex(v1); g1.addVertex(v2); g1.addVertex(v3); g1.addEdge(v1, v2); g1.addEdge(v2, v3); g1.addEdge(v3, v1); VF2GraphIsomorphismInspector<String, DefaultEdge> v... | @Override public VF2GraphMappingIterator<V, E> getMappings() { return new VF2GraphMappingIterator<>( ordering1, ordering2, vertexComparator, edgeComparator); } | VF2GraphIsomorphismInspector extends VF2AbstractIsomorphismInspector<V, E> { @Override public VF2GraphMappingIterator<V, E> getMappings() { return new VF2GraphMappingIterator<>( ordering1, ordering2, vertexComparator, edgeComparator); } } | VF2GraphIsomorphismInspector extends VF2AbstractIsomorphismInspector<V, E> { @Override public VF2GraphMappingIterator<V, E> getMappings() { return new VF2GraphMappingIterator<>( ordering1, ordering2, vertexComparator, edgeComparator); } VF2GraphIsomorphismInspector(
Graph<V, E> graph1, Graph<V, E> graph2, Compa... | VF2GraphIsomorphismInspector extends VF2AbstractIsomorphismInspector<V, E> { @Override public VF2GraphMappingIterator<V, E> getMappings() { return new VF2GraphMappingIterator<>( ordering1, ordering2, vertexComparator, edgeComparator); } VF2GraphIsomorphismInspector(
Graph<V, E> graph1, Graph<V, E> graph2, Compa... | VF2GraphIsomorphismInspector extends VF2AbstractIsomorphismInspector<V, E> { @Override public VF2GraphMappingIterator<V, E> getMappings() { return new VF2GraphMappingIterator<>( ordering1, ordering2, vertexComparator, edgeComparator); } VF2GraphIsomorphismInspector(
Graph<V, E> graph1, Graph<V, E> graph2, Compa... |
@Test public void testGraphTypes() { Graph<Integer, DefaultEdge> dg1 = new DefaultDirectedGraph<>(DefaultEdge.class); dg1.addVertex(1); dg1.addVertex(2); dg1.addEdge(1, 2); SimpleGraph<Integer, DefaultEdge> sg1 = new SimpleGraph<>(DefaultEdge.class); sg1.addVertex(1); sg1.addVertex(2); sg1.addEdge(1, 2); Multigraph<Int... | @Override public VF2SubgraphMappingIterator<V, E> getMappings() { return new VF2SubgraphMappingIterator<>( ordering1, ordering2, vertexComparator, edgeComparator); } | VF2SubgraphIsomorphismInspector extends VF2AbstractIsomorphismInspector<V, E> { @Override public VF2SubgraphMappingIterator<V, E> getMappings() { return new VF2SubgraphMappingIterator<>( ordering1, ordering2, vertexComparator, edgeComparator); } } | VF2SubgraphIsomorphismInspector extends VF2AbstractIsomorphismInspector<V, E> { @Override public VF2SubgraphMappingIterator<V, E> getMappings() { return new VF2SubgraphMappingIterator<>( ordering1, ordering2, vertexComparator, edgeComparator); } VF2SubgraphIsomorphismInspector(
Graph<V, E> graph1, Graph<V, E> g... | VF2SubgraphIsomorphismInspector extends VF2AbstractIsomorphismInspector<V, E> { @Override public VF2SubgraphMappingIterator<V, E> getMappings() { return new VF2SubgraphMappingIterator<>( ordering1, ordering2, vertexComparator, edgeComparator); } VF2SubgraphIsomorphismInspector(
Graph<V, E> graph1, Graph<V, E> g... | VF2SubgraphIsomorphismInspector extends VF2AbstractIsomorphismInspector<V, E> { @Override public VF2SubgraphMappingIterator<V, E> getMappings() { return new VF2SubgraphMappingIterator<>( ordering1, ordering2, vertexComparator, edgeComparator); } VF2SubgraphIsomorphismInspector(
Graph<V, E> graph1, Graph<V, E> g... |
@Test public void testEdgeCasesSimpleGraph() { SimpleGraph<Integer, DefaultEdge> sg0v = new SimpleGraph<>(DefaultEdge.class), sg0v2 = new SimpleGraph<>(DefaultEdge.class); VF2SubgraphIsomorphismInspector<Integer, DefaultEdge> vfs1 = new VF2SubgraphIsomorphismInspector<>(sg0v, sg0v2); assertEquals("[]", vfs1.getMappings... | @Override public VF2SubgraphMappingIterator<V, E> getMappings() { return new VF2SubgraphMappingIterator<>( ordering1, ordering2, vertexComparator, edgeComparator); } | VF2SubgraphIsomorphismInspector extends VF2AbstractIsomorphismInspector<V, E> { @Override public VF2SubgraphMappingIterator<V, E> getMappings() { return new VF2SubgraphMappingIterator<>( ordering1, ordering2, vertexComparator, edgeComparator); } } | VF2SubgraphIsomorphismInspector extends VF2AbstractIsomorphismInspector<V, E> { @Override public VF2SubgraphMappingIterator<V, E> getMappings() { return new VF2SubgraphMappingIterator<>( ordering1, ordering2, vertexComparator, edgeComparator); } VF2SubgraphIsomorphismInspector(
Graph<V, E> graph1, Graph<V, E> g... | VF2SubgraphIsomorphismInspector extends VF2AbstractIsomorphismInspector<V, E> { @Override public VF2SubgraphMappingIterator<V, E> getMappings() { return new VF2SubgraphMappingIterator<>( ordering1, ordering2, vertexComparator, edgeComparator); } VF2SubgraphIsomorphismInspector(
Graph<V, E> graph1, Graph<V, E> g... | VF2SubgraphIsomorphismInspector extends VF2AbstractIsomorphismInspector<V, E> { @Override public VF2SubgraphMappingIterator<V, E> getMappings() { return new VF2SubgraphMappingIterator<>( ordering1, ordering2, vertexComparator, edgeComparator); } VF2SubgraphIsomorphismInspector(
Graph<V, E> graph1, Graph<V, E> g... |
@Test public void testEdgeCasesDirectedGraph() { Graph<Integer, DefaultEdge> dg0v = new DefaultDirectedGraph<>(DefaultEdge.class), dg0v2 = new DefaultDirectedGraph<>(DefaultEdge.class); VF2SubgraphIsomorphismInspector<Integer, DefaultEdge> vf1 = new VF2SubgraphIsomorphismInspector<>(dg0v, dg0v2); assertEquals("[]", vf1... | @Override public VF2SubgraphMappingIterator<V, E> getMappings() { return new VF2SubgraphMappingIterator<>( ordering1, ordering2, vertexComparator, edgeComparator); } | VF2SubgraphIsomorphismInspector extends VF2AbstractIsomorphismInspector<V, E> { @Override public VF2SubgraphMappingIterator<V, E> getMappings() { return new VF2SubgraphMappingIterator<>( ordering1, ordering2, vertexComparator, edgeComparator); } } | VF2SubgraphIsomorphismInspector extends VF2AbstractIsomorphismInspector<V, E> { @Override public VF2SubgraphMappingIterator<V, E> getMappings() { return new VF2SubgraphMappingIterator<>( ordering1, ordering2, vertexComparator, edgeComparator); } VF2SubgraphIsomorphismInspector(
Graph<V, E> graph1, Graph<V, E> g... | VF2SubgraphIsomorphismInspector extends VF2AbstractIsomorphismInspector<V, E> { @Override public VF2SubgraphMappingIterator<V, E> getMappings() { return new VF2SubgraphMappingIterator<>( ordering1, ordering2, vertexComparator, edgeComparator); } VF2SubgraphIsomorphismInspector(
Graph<V, E> graph1, Graph<V, E> g... | VF2SubgraphIsomorphismInspector extends VF2AbstractIsomorphismInspector<V, E> { @Override public VF2SubgraphMappingIterator<V, E> getMappings() { return new VF2SubgraphMappingIterator<>( ordering1, ordering2, vertexComparator, edgeComparator); } VF2SubgraphIsomorphismInspector(
Graph<V, E> graph1, Graph<V, E> g... |
@Test public void testRandomGraphs() { Random rnd = new Random(); rnd.setSeed(54321); for (int i = 1; i < 50; i++) { int vertexCount = 2 + rnd.nextInt(i), edgeCount = vertexCount + rnd.nextInt(vertexCount * (vertexCount - 1)) / 2, subVertexCount = 1 + rnd.nextInt(vertexCount); Graph<Integer, DefaultEdge> g1 = SubgraphI... | @Override public VF2SubgraphMappingIterator<V, E> getMappings() { return new VF2SubgraphMappingIterator<>( ordering1, ordering2, vertexComparator, edgeComparator); } | VF2SubgraphIsomorphismInspector extends VF2AbstractIsomorphismInspector<V, E> { @Override public VF2SubgraphMappingIterator<V, E> getMappings() { return new VF2SubgraphMappingIterator<>( ordering1, ordering2, vertexComparator, edgeComparator); } } | VF2SubgraphIsomorphismInspector extends VF2AbstractIsomorphismInspector<V, E> { @Override public VF2SubgraphMappingIterator<V, E> getMappings() { return new VF2SubgraphMappingIterator<>( ordering1, ordering2, vertexComparator, edgeComparator); } VF2SubgraphIsomorphismInspector(
Graph<V, E> graph1, Graph<V, E> g... | VF2SubgraphIsomorphismInspector extends VF2AbstractIsomorphismInspector<V, E> { @Override public VF2SubgraphMappingIterator<V, E> getMappings() { return new VF2SubgraphMappingIterator<>( ordering1, ordering2, vertexComparator, edgeComparator); } VF2SubgraphIsomorphismInspector(
Graph<V, E> graph1, Graph<V, E> g... | VF2SubgraphIsomorphismInspector extends VF2AbstractIsomorphismInspector<V, E> { @Override public VF2SubgraphMappingIterator<V, E> getMappings() { return new VF2SubgraphMappingIterator<>( ordering1, ordering2, vertexComparator, edgeComparator); } VF2SubgraphIsomorphismInspector(
Graph<V, E> graph1, Graph<V, E> g... |
@Test public void testSemanticCheck() { SimpleGraph<String, Integer> g1 = new SimpleGraph<>(Integer.class), g2 = new SimpleGraph<>(Integer.class); g1.addVertex("a"); g1.addVertex("b"); g1.addVertex("A"); g1.addVertex("B"); g1.addEdge("a", "b", 3); g1.addEdge("b", "B", 1); g1.addEdge("B", "A", 2); g1.addEdge("A", "a", 4... | @Override public VF2SubgraphMappingIterator<V, E> getMappings() { return new VF2SubgraphMappingIterator<>( ordering1, ordering2, vertexComparator, edgeComparator); } | VF2SubgraphIsomorphismInspector extends VF2AbstractIsomorphismInspector<V, E> { @Override public VF2SubgraphMappingIterator<V, E> getMappings() { return new VF2SubgraphMappingIterator<>( ordering1, ordering2, vertexComparator, edgeComparator); } } | VF2SubgraphIsomorphismInspector extends VF2AbstractIsomorphismInspector<V, E> { @Override public VF2SubgraphMappingIterator<V, E> getMappings() { return new VF2SubgraphMappingIterator<>( ordering1, ordering2, vertexComparator, edgeComparator); } VF2SubgraphIsomorphismInspector(
Graph<V, E> graph1, Graph<V, E> g... | VF2SubgraphIsomorphismInspector extends VF2AbstractIsomorphismInspector<V, E> { @Override public VF2SubgraphMappingIterator<V, E> getMappings() { return new VF2SubgraphMappingIterator<>( ordering1, ordering2, vertexComparator, edgeComparator); } VF2SubgraphIsomorphismInspector(
Graph<V, E> graph1, Graph<V, E> g... | VF2SubgraphIsomorphismInspector extends VF2AbstractIsomorphismInspector<V, E> { @Override public VF2SubgraphMappingIterator<V, E> getMappings() { return new VF2SubgraphMappingIterator<>( ordering1, ordering2, vertexComparator, edgeComparator); } VF2SubgraphIsomorphismInspector(
Graph<V, E> graph1, Graph<V, E> g... |
@Test public void testGraph2a() throws UnsupportedEncodingException, ExportException, ImportException { Graph<Integer, DefaultEdge> orig= NamedGraphGenerator.ellinghamHorton78Graph(); String res = exportGraph(orig, Graph6Sparse6Exporter.Format.SPARSE6); Graph<Integer, DefaultEdge> g = importGraph(res); this.compare(ori... | @Override public void exportGraph(Graph<V, E> g, Writer writer) throws ExportException { GraphTests.requireUndirected(g); if(format == Format.GRAPH6 && !GraphTests.isSimple(g)) throw new ExportException("Graphs exported in graph6 format cannot contain loops or multiple edges."); List<V> vertices = new ArrayList<>(g.ver... | Graph6Sparse6Exporter implements GraphExporter<V, E> { @Override public void exportGraph(Graph<V, E> g, Writer writer) throws ExportException { GraphTests.requireUndirected(g); if(format == Format.GRAPH6 && !GraphTests.isSimple(g)) throw new ExportException("Graphs exported in graph6 format cannot contain loops or mult... | Graph6Sparse6Exporter implements GraphExporter<V, E> { @Override public void exportGraph(Graph<V, E> g, Writer writer) throws ExportException { GraphTests.requireUndirected(g); if(format == Format.GRAPH6 && !GraphTests.isSimple(g)) throw new ExportException("Graphs exported in graph6 format cannot contain loops or mult... | Graph6Sparse6Exporter implements GraphExporter<V, E> { @Override public void exportGraph(Graph<V, E> g, Writer writer) throws ExportException { GraphTests.requireUndirected(g); if(format == Format.GRAPH6 && !GraphTests.isSimple(g)) throw new ExportException("Graphs exported in graph6 format cannot contain loops or mult... | Graph6Sparse6Exporter implements GraphExporter<V, E> { @Override public void exportGraph(Graph<V, E> g, Writer writer) throws ExportException { GraphTests.requireUndirected(g); if(format == Format.GRAPH6 && !GraphTests.isSimple(g)) throw new ExportException("Graphs exported in graph6 format cannot contain loops or mult... |
@Test public void testSaturationDegree() { Graph<Integer, DefaultEdge> g = new Pseudograph<>(DefaultEdge.class); Graphs.addAllVertices(g, Arrays.asList(1, 2, 3, 4, 5, 6)); g.addEdge(2, 3); g.addEdge(4, 5); g.addEdge(4, 6); g.addEdge(5, 6); g.addEdge(5, 3); Coloring<Integer> coloring = new SaturationDegreeColoring<>(g).... | @Override @SuppressWarnings("unchecked") public Coloring<V> getColoring() { int n = graph.vertexSet().size(); int maxColor = -1; Map<V, Integer> colors = new HashMap<>(n); Map<V, BitSet> adjColors = new HashMap<>(n); Map<V, Integer> saturation = new HashMap<>(n); int maxDegree = 0; Map<V, Integer> degree = new HashMap<... | SaturationDegreeColoring implements VertexColoringAlgorithm<V> { @Override @SuppressWarnings("unchecked") public Coloring<V> getColoring() { int n = graph.vertexSet().size(); int maxColor = -1; Map<V, Integer> colors = new HashMap<>(n); Map<V, BitSet> adjColors = new HashMap<>(n); Map<V, Integer> saturation = new HashM... | SaturationDegreeColoring implements VertexColoringAlgorithm<V> { @Override @SuppressWarnings("unchecked") public Coloring<V> getColoring() { int n = graph.vertexSet().size(); int maxColor = -1; Map<V, Integer> colors = new HashMap<>(n); Map<V, BitSet> adjColors = new HashMap<>(n); Map<V, Integer> saturation = new HashM... | SaturationDegreeColoring implements VertexColoringAlgorithm<V> { @Override @SuppressWarnings("unchecked") public Coloring<V> getColoring() { int n = graph.vertexSet().size(); int maxColor = -1; Map<V, Integer> colors = new HashMap<>(n); Map<V, BitSet> adjColors = new HashMap<>(n); Map<V, Integer> saturation = new HashM... | SaturationDegreeColoring implements VertexColoringAlgorithm<V> { @Override @SuppressWarnings("unchecked") public Coloring<V> getColoring() { int n = graph.vertexSet().size(); int maxColor = -1; Map<V, Integer> colors = new HashMap<>(n); Map<V, BitSet> adjColors = new HashMap<>(n); Map<V, Integer> saturation = new HashM... |
@Test public void testLargestDegreeFirstColoring() { Graph<Integer, DefaultEdge> g = new SimpleGraph<>(DefaultEdge.class); Graphs.addAllVertices(g, Arrays.asList(1, 2, 3, 4, 5)); g.addEdge(1, 2); g.addEdge(1, 3); g.addEdge(1, 3); g.addEdge(1, 4); g.addEdge(1, 5); g.addEdge(2, 3); g.addEdge(3, 4); g.addEdge(3, 5); Color... | public LargestDegreeFirstColoring(Graph<V, E> graph) { super(graph); } | LargestDegreeFirstColoring extends GreedyColoring<V, E> { public LargestDegreeFirstColoring(Graph<V, E> graph) { super(graph); } } | LargestDegreeFirstColoring extends GreedyColoring<V, E> { public LargestDegreeFirstColoring(Graph<V, E> graph) { super(graph); } LargestDegreeFirstColoring(Graph<V, E> graph); } | LargestDegreeFirstColoring extends GreedyColoring<V, E> { public LargestDegreeFirstColoring(Graph<V, E> graph) { super(graph); } LargestDegreeFirstColoring(Graph<V, E> graph); } | LargestDegreeFirstColoring extends GreedyColoring<V, E> { public LargestDegreeFirstColoring(Graph<V, E> graph) { super(graph); } LargestDegreeFirstColoring(Graph<V, E> graph); } |
@Test public void testSmallestDegreeLastColoring() { Graph<Integer, DefaultEdge> g = createGraph1(); Coloring<Integer> coloring = new SmallestDegreeLastColoring<>(g).getColoring(); assertEquals(3, coloring.getNumberColors()); Map<Integer, Integer> colors = coloring.getColors(); assertEquals(2, colors.get(1).intValue())... | public SmallestDegreeLastColoring(Graph<V, E> graph) { super(graph); } | SmallestDegreeLastColoring extends GreedyColoring<V, E> { public SmallestDegreeLastColoring(Graph<V, E> graph) { super(graph); } } | SmallestDegreeLastColoring extends GreedyColoring<V, E> { public SmallestDegreeLastColoring(Graph<V, E> graph) { super(graph); } SmallestDegreeLastColoring(Graph<V, E> graph); } | SmallestDegreeLastColoring extends GreedyColoring<V, E> { public SmallestDegreeLastColoring(Graph<V, E> graph) { super(graph); } SmallestDegreeLastColoring(Graph<V, E> graph); } | SmallestDegreeLastColoring extends GreedyColoring<V, E> { public SmallestDegreeLastColoring(Graph<V, E> graph) { super(graph); } SmallestDegreeLastColoring(Graph<V, E> graph); } |
@Test public void testGreedy() { Graph<Integer, DefaultEdge> g = createGraph1(); Coloring<Integer> coloring = new GreedyColoring<>(g).getColoring(); assertEquals(3, coloring.getNumberColors()); Map<Integer, Integer> colors = coloring.getColors(); assertEquals(0, colors.get(1).intValue()); assertEquals(1, colors.get(2).... | @Override public Coloring<V> getColoring() { int maxColor = -1; Map<V, Integer> colors = new HashMap<>(); Set<Integer> used = new HashSet<>(); for (V v : getVertexOrdering()) { for (E e : graph.edgesOf(v)) { V u = Graphs.getOppositeVertex(graph, e, v); if (v.equals(u)) { throw new IllegalArgumentException(SELF_LOOPS_NO... | GreedyColoring implements VertexColoringAlgorithm<V> { @Override public Coloring<V> getColoring() { int maxColor = -1; Map<V, Integer> colors = new HashMap<>(); Set<Integer> used = new HashSet<>(); for (V v : getVertexOrdering()) { for (E e : graph.edgesOf(v)) { V u = Graphs.getOppositeVertex(graph, e, v); if (v.equals... | GreedyColoring implements VertexColoringAlgorithm<V> { @Override public Coloring<V> getColoring() { int maxColor = -1; Map<V, Integer> colors = new HashMap<>(); Set<Integer> used = new HashSet<>(); for (V v : getVertexOrdering()) { for (E e : graph.edgesOf(v)) { V u = Graphs.getOppositeVertex(graph, e, v); if (v.equals... | GreedyColoring implements VertexColoringAlgorithm<V> { @Override public Coloring<V> getColoring() { int maxColor = -1; Map<V, Integer> colors = new HashMap<>(); Set<Integer> used = new HashSet<>(); for (V v : getVertexOrdering()) { for (E e : graph.edgesOf(v)) { V u = Graphs.getOppositeVertex(graph, e, v); if (v.equals... | GreedyColoring implements VertexColoringAlgorithm<V> { @Override public Coloring<V> getColoring() { int maxColor = -1; Map<V, Integer> colors = new HashMap<>(); Set<Integer> used = new HashSet<>(); for (V v : getVertexOrdering()) { for (E e : graph.edgesOf(v)) { V u = Graphs.getOppositeVertex(graph, e, v); if (v.equals... |
@Test(expected = NullPointerException.class) public void testReduceNull() { TransitiveReduction.INSTANCE.reduce(null); } | public <V, E> void reduce(final Graph<V, E> directedGraph) { GraphTests.requireDirected(directedGraph, "Graph must be directed"); final List<V> vertices = new ArrayList<>(directedGraph.vertexSet()); final int n = vertices.size(); BitSet[] originalMatrix = new BitSet[n]; for (int i = 0; i < originalMatrix.length; i++) {... | TransitiveReduction { public <V, E> void reduce(final Graph<V, E> directedGraph) { GraphTests.requireDirected(directedGraph, "Graph must be directed"); final List<V> vertices = new ArrayList<>(directedGraph.vertexSet()); final int n = vertices.size(); BitSet[] originalMatrix = new BitSet[n]; for (int i = 0; i < origina... | TransitiveReduction { public <V, E> void reduce(final Graph<V, E> directedGraph) { GraphTests.requireDirected(directedGraph, "Graph must be directed"); final List<V> vertices = new ArrayList<>(directedGraph.vertexSet()); final int n = vertices.size(); BitSet[] originalMatrix = new BitSet[n]; for (int i = 0; i < origina... | TransitiveReduction { public <V, E> void reduce(final Graph<V, E> directedGraph) { GraphTests.requireDirected(directedGraph, "Graph must be directed"); final List<V> vertices = new ArrayList<>(directedGraph.vertexSet()); final int n = vertices.size(); BitSet[] originalMatrix = new BitSet[n]; for (int i = 0; i < origina... | TransitiveReduction { public <V, E> void reduce(final Graph<V, E> directedGraph) { GraphTests.requireDirected(directedGraph, "Graph must be directed"); final List<V> vertices = new ArrayList<>(directedGraph.vertexSet()); final int n = vertices.size(); BitSet[] originalMatrix = new BitSet[n]; for (int i = 0; i < origina... |
@Test public void testReduceNoVertexNoEdge() { SimpleDirectedGraph<String, DefaultEdge> graph = new SimpleDirectedGraph<>(DefaultEdge.class); TransitiveReduction.INSTANCE.reduce(graph); assertEquals(graph.vertexSet().size(), 0); assertEquals(graph.edgeSet().size(), 0); } | public <V, E> void reduce(final Graph<V, E> directedGraph) { GraphTests.requireDirected(directedGraph, "Graph must be directed"); final List<V> vertices = new ArrayList<>(directedGraph.vertexSet()); final int n = vertices.size(); BitSet[] originalMatrix = new BitSet[n]; for (int i = 0; i < originalMatrix.length; i++) {... | TransitiveReduction { public <V, E> void reduce(final Graph<V, E> directedGraph) { GraphTests.requireDirected(directedGraph, "Graph must be directed"); final List<V> vertices = new ArrayList<>(directedGraph.vertexSet()); final int n = vertices.size(); BitSet[] originalMatrix = new BitSet[n]; for (int i = 0; i < origina... | TransitiveReduction { public <V, E> void reduce(final Graph<V, E> directedGraph) { GraphTests.requireDirected(directedGraph, "Graph must be directed"); final List<V> vertices = new ArrayList<>(directedGraph.vertexSet()); final int n = vertices.size(); BitSet[] originalMatrix = new BitSet[n]; for (int i = 0; i < origina... | TransitiveReduction { public <V, E> void reduce(final Graph<V, E> directedGraph) { GraphTests.requireDirected(directedGraph, "Graph must be directed"); final List<V> vertices = new ArrayList<>(directedGraph.vertexSet()); final int n = vertices.size(); BitSet[] originalMatrix = new BitSet[n]; for (int i = 0; i < origina... | TransitiveReduction { public <V, E> void reduce(final Graph<V, E> directedGraph) { GraphTests.requireDirected(directedGraph, "Graph must be directed"); final List<V> vertices = new ArrayList<>(directedGraph.vertexSet()); final int n = vertices.size(); BitSet[] originalMatrix = new BitSet[n]; for (int i = 0; i < origina... |
@Test public void testReduceSomeVerticesNoEdge() { SimpleDirectedGraph<String, DefaultEdge> graph = new SimpleDirectedGraph<>(DefaultEdge.class); graph.addVertex("x"); graph.addVertex("y"); graph.addVertex("z"); TransitiveReduction.INSTANCE.reduce(graph); assertEquals(graph.vertexSet().size(), 3); assertEquals(graph.ed... | public <V, E> void reduce(final Graph<V, E> directedGraph) { GraphTests.requireDirected(directedGraph, "Graph must be directed"); final List<V> vertices = new ArrayList<>(directedGraph.vertexSet()); final int n = vertices.size(); BitSet[] originalMatrix = new BitSet[n]; for (int i = 0; i < originalMatrix.length; i++) {... | TransitiveReduction { public <V, E> void reduce(final Graph<V, E> directedGraph) { GraphTests.requireDirected(directedGraph, "Graph must be directed"); final List<V> vertices = new ArrayList<>(directedGraph.vertexSet()); final int n = vertices.size(); BitSet[] originalMatrix = new BitSet[n]; for (int i = 0; i < origina... | TransitiveReduction { public <V, E> void reduce(final Graph<V, E> directedGraph) { GraphTests.requireDirected(directedGraph, "Graph must be directed"); final List<V> vertices = new ArrayList<>(directedGraph.vertexSet()); final int n = vertices.size(); BitSet[] originalMatrix = new BitSet[n]; for (int i = 0; i < origina... | TransitiveReduction { public <V, E> void reduce(final Graph<V, E> directedGraph) { GraphTests.requireDirected(directedGraph, "Graph must be directed"); final List<V> vertices = new ArrayList<>(directedGraph.vertexSet()); final int n = vertices.size(); BitSet[] originalMatrix = new BitSet[n]; for (int i = 0; i < origina... | TransitiveReduction { public <V, E> void reduce(final Graph<V, E> directedGraph) { GraphTests.requireDirected(directedGraph, "Graph must be directed"); final List<V> vertices = new ArrayList<>(directedGraph.vertexSet()); final int n = vertices.size(); BitSet[] originalMatrix = new BitSet[n]; for (int i = 0; i < origina... |
@Test public void testReduceAlreadyReduced() { SimpleDirectedGraph<String, DefaultEdge> graph = new SimpleDirectedGraph<>(DefaultEdge.class); graph.addVertex("x"); graph.addVertex("y"); graph.addVertex("z"); graph.addEdge("x", "y"); graph.addEdge("y", "z"); assertEquals(graph.vertexSet().size(), 3); assertEquals(graph.... | public <V, E> void reduce(final Graph<V, E> directedGraph) { GraphTests.requireDirected(directedGraph, "Graph must be directed"); final List<V> vertices = new ArrayList<>(directedGraph.vertexSet()); final int n = vertices.size(); BitSet[] originalMatrix = new BitSet[n]; for (int i = 0; i < originalMatrix.length; i++) {... | TransitiveReduction { public <V, E> void reduce(final Graph<V, E> directedGraph) { GraphTests.requireDirected(directedGraph, "Graph must be directed"); final List<V> vertices = new ArrayList<>(directedGraph.vertexSet()); final int n = vertices.size(); BitSet[] originalMatrix = new BitSet[n]; for (int i = 0; i < origina... | TransitiveReduction { public <V, E> void reduce(final Graph<V, E> directedGraph) { GraphTests.requireDirected(directedGraph, "Graph must be directed"); final List<V> vertices = new ArrayList<>(directedGraph.vertexSet()); final int n = vertices.size(); BitSet[] originalMatrix = new BitSet[n]; for (int i = 0; i < origina... | TransitiveReduction { public <V, E> void reduce(final Graph<V, E> directedGraph) { GraphTests.requireDirected(directedGraph, "Graph must be directed"); final List<V> vertices = new ArrayList<>(directedGraph.vertexSet()); final int n = vertices.size(); BitSet[] originalMatrix = new BitSet[n]; for (int i = 0; i < origina... | TransitiveReduction { public <V, E> void reduce(final Graph<V, E> directedGraph) { GraphTests.requireDirected(directedGraph, "Graph must be directed"); final List<V> vertices = new ArrayList<>(directedGraph.vertexSet()); final int n = vertices.size(); BitSet[] originalMatrix = new BitSet[n]; for (int i = 0; i < origina... |
@Test public void testReduceBasic() { SimpleDirectedGraph<String, DefaultEdge> graph = new SimpleDirectedGraph<>(DefaultEdge.class); graph.addVertex("x"); graph.addVertex("y"); graph.addVertex("z"); graph.addEdge("x", "y"); graph.addEdge("y", "z"); graph.addEdge("x", "z"); assertEquals(graph.vertexSet().size(), 3); ass... | public <V, E> void reduce(final Graph<V, E> directedGraph) { GraphTests.requireDirected(directedGraph, "Graph must be directed"); final List<V> vertices = new ArrayList<>(directedGraph.vertexSet()); final int n = vertices.size(); BitSet[] originalMatrix = new BitSet[n]; for (int i = 0; i < originalMatrix.length; i++) {... | TransitiveReduction { public <V, E> void reduce(final Graph<V, E> directedGraph) { GraphTests.requireDirected(directedGraph, "Graph must be directed"); final List<V> vertices = new ArrayList<>(directedGraph.vertexSet()); final int n = vertices.size(); BitSet[] originalMatrix = new BitSet[n]; for (int i = 0; i < origina... | TransitiveReduction { public <V, E> void reduce(final Graph<V, E> directedGraph) { GraphTests.requireDirected(directedGraph, "Graph must be directed"); final List<V> vertices = new ArrayList<>(directedGraph.vertexSet()); final int n = vertices.size(); BitSet[] originalMatrix = new BitSet[n]; for (int i = 0; i < origina... | TransitiveReduction { public <V, E> void reduce(final Graph<V, E> directedGraph) { GraphTests.requireDirected(directedGraph, "Graph must be directed"); final List<V> vertices = new ArrayList<>(directedGraph.vertexSet()); final int n = vertices.size(); BitSet[] originalMatrix = new BitSet[n]; for (int i = 0; i < origina... | TransitiveReduction { public <V, E> void reduce(final Graph<V, E> directedGraph) { GraphTests.requireDirected(directedGraph, "Graph must be directed"); final List<V> vertices = new ArrayList<>(directedGraph.vertexSet()); final int n = vertices.size(); BitSet[] originalMatrix = new BitSet[n]; for (int i = 0; i < origina... |
@Test public void testReduceFarAway() { SimpleDirectedGraph<String, DefaultEdge> graph = new SimpleDirectedGraph<>(DefaultEdge.class); graph.addVertex("a"); graph.addVertex("b"); graph.addVertex("c"); graph.addVertex("x"); graph.addVertex("y"); graph.addVertex("z"); graph.addEdge("a", "b"); graph.addEdge("b", "c"); gra... | public <V, E> void reduce(final Graph<V, E> directedGraph) { GraphTests.requireDirected(directedGraph, "Graph must be directed"); final List<V> vertices = new ArrayList<>(directedGraph.vertexSet()); final int n = vertices.size(); BitSet[] originalMatrix = new BitSet[n]; for (int i = 0; i < originalMatrix.length; i++) {... | TransitiveReduction { public <V, E> void reduce(final Graph<V, E> directedGraph) { GraphTests.requireDirected(directedGraph, "Graph must be directed"); final List<V> vertices = new ArrayList<>(directedGraph.vertexSet()); final int n = vertices.size(); BitSet[] originalMatrix = new BitSet[n]; for (int i = 0; i < origina... | TransitiveReduction { public <V, E> void reduce(final Graph<V, E> directedGraph) { GraphTests.requireDirected(directedGraph, "Graph must be directed"); final List<V> vertices = new ArrayList<>(directedGraph.vertexSet()); final int n = vertices.size(); BitSet[] originalMatrix = new BitSet[n]; for (int i = 0; i < origina... | TransitiveReduction { public <V, E> void reduce(final Graph<V, E> directedGraph) { GraphTests.requireDirected(directedGraph, "Graph must be directed"); final List<V> vertices = new ArrayList<>(directedGraph.vertexSet()); final int n = vertices.size(); BitSet[] originalMatrix = new BitSet[n]; for (int i = 0; i < origina... | TransitiveReduction { public <V, E> void reduce(final Graph<V, E> directedGraph) { GraphTests.requireDirected(directedGraph, "Graph must be directed"); final List<V> vertices = new ArrayList<>(directedGraph.vertexSet()); final int n = vertices.size(); BitSet[] originalMatrix = new BitSet[n]; for (int i = 0; i < origina... |
@Test public void testGraph3a() throws UnsupportedEncodingException, ExportException, ImportException { Graph<Integer, DefaultEdge> orig= NamedGraphGenerator.klein3RegularGraph(); String res = exportGraph(orig, Graph6Sparse6Exporter.Format.SPARSE6); Graph<Integer, DefaultEdge> g = importGraph(res); this.compare(orig, g... | @Override public void exportGraph(Graph<V, E> g, Writer writer) throws ExportException { GraphTests.requireUndirected(g); if(format == Format.GRAPH6 && !GraphTests.isSimple(g)) throw new ExportException("Graphs exported in graph6 format cannot contain loops or multiple edges."); List<V> vertices = new ArrayList<>(g.ver... | Graph6Sparse6Exporter implements GraphExporter<V, E> { @Override public void exportGraph(Graph<V, E> g, Writer writer) throws ExportException { GraphTests.requireUndirected(g); if(format == Format.GRAPH6 && !GraphTests.isSimple(g)) throw new ExportException("Graphs exported in graph6 format cannot contain loops or mult... | Graph6Sparse6Exporter implements GraphExporter<V, E> { @Override public void exportGraph(Graph<V, E> g, Writer writer) throws ExportException { GraphTests.requireUndirected(g); if(format == Format.GRAPH6 && !GraphTests.isSimple(g)) throw new ExportException("Graphs exported in graph6 format cannot contain loops or mult... | Graph6Sparse6Exporter implements GraphExporter<V, E> { @Override public void exportGraph(Graph<V, E> g, Writer writer) throws ExportException { GraphTests.requireUndirected(g); if(format == Format.GRAPH6 && !GraphTests.isSimple(g)) throw new ExportException("Graphs exported in graph6 format cannot contain loops or mult... | Graph6Sparse6Exporter implements GraphExporter<V, E> { @Override public void exportGraph(Graph<V, E> g, Writer writer) throws ExportException { GraphTests.requireUndirected(g); if(format == Format.GRAPH6 && !GraphTests.isSimple(g)) throw new ExportException("Graphs exported in graph6 format cannot contain loops or mult... |
@Test public void testReduceCanonicalGraph() { Graph<Integer, DefaultEdge> graph = fromMatrixToDirectedGraph(matrix); assertFalse(graph.containsEdge(0, 0)); assertTrue(graph.containsEdge(0, 1)); assertTrue(graph.containsEdge(2, 4)); assertTrue(graph.containsEdge(4, 1)); assertEquals(graph.vertexSet().size(), 5); assert... | public <V, E> void reduce(final Graph<V, E> directedGraph) { GraphTests.requireDirected(directedGraph, "Graph must be directed"); final List<V> vertices = new ArrayList<>(directedGraph.vertexSet()); final int n = vertices.size(); BitSet[] originalMatrix = new BitSet[n]; for (int i = 0; i < originalMatrix.length; i++) {... | TransitiveReduction { public <V, E> void reduce(final Graph<V, E> directedGraph) { GraphTests.requireDirected(directedGraph, "Graph must be directed"); final List<V> vertices = new ArrayList<>(directedGraph.vertexSet()); final int n = vertices.size(); BitSet[] originalMatrix = new BitSet[n]; for (int i = 0; i < origina... | TransitiveReduction { public <V, E> void reduce(final Graph<V, E> directedGraph) { GraphTests.requireDirected(directedGraph, "Graph must be directed"); final List<V> vertices = new ArrayList<>(directedGraph.vertexSet()); final int n = vertices.size(); BitSet[] originalMatrix = new BitSet[n]; for (int i = 0; i < origina... | TransitiveReduction { public <V, E> void reduce(final Graph<V, E> directedGraph) { GraphTests.requireDirected(directedGraph, "Graph must be directed"); final List<V> vertices = new ArrayList<>(directedGraph.vertexSet()); final int n = vertices.size(); BitSet[] originalMatrix = new BitSet[n]; for (int i = 0; i < origina... | TransitiveReduction { public <V, E> void reduce(final Graph<V, E> directedGraph) { GraphTests.requireDirected(directedGraph, "Graph must be directed"); final List<V> vertices = new ArrayList<>(directedGraph.vertexSet()); final int n = vertices.size(); BitSet[] originalMatrix = new BitSet[n]; for (int i = 0; i < origina... |
@Test public void testNullEulerian() { Graph<Integer, DefaultEdge> g1 = new Pseudograph<>(DefaultEdge.class); Assert.assertFalse(new HierholzerEulerianCycle<Integer, DefaultEdge>().isEulerian(g1)); Graph<Integer, DefaultEdge> g2 = new DirectedPseudograph<>(DefaultEdge.class); Assert.assertFalse(new HierholzerEulerianCy... | public boolean isEulerian(Graph<V, E> graph) { GraphTests.requireDirectedOrUndirected(graph); if (graph.vertexSet().isEmpty()) { return false; } else if (graph.edgeSet().isEmpty()) { return true; } else if (graph.getType().isUndirected()) { for (V v : graph.vertexSet()) { if (graph.degreeOf(v) % 2 == 1) { return false;... | HierholzerEulerianCycle implements EulerianCycleAlgorithm<V, E> { public boolean isEulerian(Graph<V, E> graph) { GraphTests.requireDirectedOrUndirected(graph); if (graph.vertexSet().isEmpty()) { return false; } else if (graph.edgeSet().isEmpty()) { return true; } else if (graph.getType().isUndirected()) { for (V v : gr... | HierholzerEulerianCycle implements EulerianCycleAlgorithm<V, E> { public boolean isEulerian(Graph<V, E> graph) { GraphTests.requireDirectedOrUndirected(graph); if (graph.vertexSet().isEmpty()) { return false; } else if (graph.edgeSet().isEmpty()) { return true; } else if (graph.getType().isUndirected()) { for (V v : gr... | HierholzerEulerianCycle implements EulerianCycleAlgorithm<V, E> { public boolean isEulerian(Graph<V, E> graph) { GraphTests.requireDirectedOrUndirected(graph); if (graph.vertexSet().isEmpty()) { return false; } else if (graph.edgeSet().isEmpty()) { return true; } else if (graph.getType().isUndirected()) { for (V v : gr... | HierholzerEulerianCycle implements EulerianCycleAlgorithm<V, E> { public boolean isEulerian(Graph<V, E> graph) { GraphTests.requireDirectedOrUndirected(graph); if (graph.vertexSet().isEmpty()) { return false; } else if (graph.edgeSet().isEmpty()) { return true; } else if (graph.getType().isUndirected()) { for (V v : gr... |
@Test public void testEmptyEulerian() { Graph<Integer, DefaultEdge> g1 = new Pseudograph<>(DefaultEdge.class); g1.addVertex(1); Assert.assertTrue(new HierholzerEulerianCycle<Integer, DefaultEdge>().isEulerian(g1)); g1.addVertex(2); Assert.assertTrue(new HierholzerEulerianCycle<Integer, DefaultEdge>().isEulerian(g1)); g... | public boolean isEulerian(Graph<V, E> graph) { GraphTests.requireDirectedOrUndirected(graph); if (graph.vertexSet().isEmpty()) { return false; } else if (graph.edgeSet().isEmpty()) { return true; } else if (graph.getType().isUndirected()) { for (V v : graph.vertexSet()) { if (graph.degreeOf(v) % 2 == 1) { return false;... | HierholzerEulerianCycle implements EulerianCycleAlgorithm<V, E> { public boolean isEulerian(Graph<V, E> graph) { GraphTests.requireDirectedOrUndirected(graph); if (graph.vertexSet().isEmpty()) { return false; } else if (graph.edgeSet().isEmpty()) { return true; } else if (graph.getType().isUndirected()) { for (V v : gr... | HierholzerEulerianCycle implements EulerianCycleAlgorithm<V, E> { public boolean isEulerian(Graph<V, E> graph) { GraphTests.requireDirectedOrUndirected(graph); if (graph.vertexSet().isEmpty()) { return false; } else if (graph.edgeSet().isEmpty()) { return true; } else if (graph.getType().isUndirected()) { for (V v : gr... | HierholzerEulerianCycle implements EulerianCycleAlgorithm<V, E> { public boolean isEulerian(Graph<V, E> graph) { GraphTests.requireDirectedOrUndirected(graph); if (graph.vertexSet().isEmpty()) { return false; } else if (graph.edgeSet().isEmpty()) { return true; } else if (graph.getType().isUndirected()) { for (V v : gr... | HierholzerEulerianCycle implements EulerianCycleAlgorithm<V, E> { public boolean isEulerian(Graph<V, E> graph) { GraphTests.requireDirectedOrUndirected(graph); if (graph.vertexSet().isEmpty()) { return false; } else if (graph.edgeSet().isEmpty()) { return true; } else if (graph.getType().isUndirected()) { for (V v : gr... |
@Test public void testUndirectedEulerian1() { Graph<Integer, DefaultEdge> g = new SimpleGraph<>(DefaultEdge.class); CompleteGraphGenerator<Integer, DefaultEdge> gen = new CompleteGraphGenerator<>(6); gen.generateGraph(g, new IntegerVertexFactory(), null); Assert.assertFalse(new HierholzerEulerianCycle<Integer, DefaultE... | public boolean isEulerian(Graph<V, E> graph) { GraphTests.requireDirectedOrUndirected(graph); if (graph.vertexSet().isEmpty()) { return false; } else if (graph.edgeSet().isEmpty()) { return true; } else if (graph.getType().isUndirected()) { for (V v : graph.vertexSet()) { if (graph.degreeOf(v) % 2 == 1) { return false;... | HierholzerEulerianCycle implements EulerianCycleAlgorithm<V, E> { public boolean isEulerian(Graph<V, E> graph) { GraphTests.requireDirectedOrUndirected(graph); if (graph.vertexSet().isEmpty()) { return false; } else if (graph.edgeSet().isEmpty()) { return true; } else if (graph.getType().isUndirected()) { for (V v : gr... | HierholzerEulerianCycle implements EulerianCycleAlgorithm<V, E> { public boolean isEulerian(Graph<V, E> graph) { GraphTests.requireDirectedOrUndirected(graph); if (graph.vertexSet().isEmpty()) { return false; } else if (graph.edgeSet().isEmpty()) { return true; } else if (graph.getType().isUndirected()) { for (V v : gr... | HierholzerEulerianCycle implements EulerianCycleAlgorithm<V, E> { public boolean isEulerian(Graph<V, E> graph) { GraphTests.requireDirectedOrUndirected(graph); if (graph.vertexSet().isEmpty()) { return false; } else if (graph.edgeSet().isEmpty()) { return true; } else if (graph.getType().isUndirected()) { for (V v : gr... | HierholzerEulerianCycle implements EulerianCycleAlgorithm<V, E> { public boolean isEulerian(Graph<V, E> graph) { GraphTests.requireDirectedOrUndirected(graph); if (graph.vertexSet().isEmpty()) { return false; } else if (graph.edgeSet().isEmpty()) { return true; } else if (graph.getType().isUndirected()) { for (V v : gr... |
@Test public void testUndirectedEulerian4() { Graph<Integer, DefaultEdge> g = new Pseudograph<>(DefaultEdge.class); g.addVertex(1); Assert.assertTrue(new HierholzerEulerianCycle<Integer, DefaultEdge>().isEulerian(g)); } | public boolean isEulerian(Graph<V, E> graph) { GraphTests.requireDirectedOrUndirected(graph); if (graph.vertexSet().isEmpty()) { return false; } else if (graph.edgeSet().isEmpty()) { return true; } else if (graph.getType().isUndirected()) { for (V v : graph.vertexSet()) { if (graph.degreeOf(v) % 2 == 1) { return false;... | HierholzerEulerianCycle implements EulerianCycleAlgorithm<V, E> { public boolean isEulerian(Graph<V, E> graph) { GraphTests.requireDirectedOrUndirected(graph); if (graph.vertexSet().isEmpty()) { return false; } else if (graph.edgeSet().isEmpty()) { return true; } else if (graph.getType().isUndirected()) { for (V v : gr... | HierholzerEulerianCycle implements EulerianCycleAlgorithm<V, E> { public boolean isEulerian(Graph<V, E> graph) { GraphTests.requireDirectedOrUndirected(graph); if (graph.vertexSet().isEmpty()) { return false; } else if (graph.edgeSet().isEmpty()) { return true; } else if (graph.getType().isUndirected()) { for (V v : gr... | HierholzerEulerianCycle implements EulerianCycleAlgorithm<V, E> { public boolean isEulerian(Graph<V, E> graph) { GraphTests.requireDirectedOrUndirected(graph); if (graph.vertexSet().isEmpty()) { return false; } else if (graph.edgeSet().isEmpty()) { return true; } else if (graph.getType().isUndirected()) { for (V v : gr... | HierholzerEulerianCycle implements EulerianCycleAlgorithm<V, E> { public boolean isEulerian(Graph<V, E> graph) { GraphTests.requireDirectedOrUndirected(graph); if (graph.vertexSet().isEmpty()) { return false; } else if (graph.edgeSet().isEmpty()) { return true; } else if (graph.getType().isUndirected()) { for (V v : gr... |
@Test public void testUndirectedEulerian7() { Graph<Integer, DefaultEdge> g = new SimpleGraph<>(DefaultEdge.class); CompleteGraphGenerator<Integer, DefaultEdge> gen = new CompleteGraphGenerator<>(5); gen.generateGraph(g, new IntegerVertexFactory(), null); Assert.assertTrue(new HierholzerEulerianCycle<Integer, DefaultEd... | public boolean isEulerian(Graph<V, E> graph) { GraphTests.requireDirectedOrUndirected(graph); if (graph.vertexSet().isEmpty()) { return false; } else if (graph.edgeSet().isEmpty()) { return true; } else if (graph.getType().isUndirected()) { for (V v : graph.vertexSet()) { if (graph.degreeOf(v) % 2 == 1) { return false;... | HierholzerEulerianCycle implements EulerianCycleAlgorithm<V, E> { public boolean isEulerian(Graph<V, E> graph) { GraphTests.requireDirectedOrUndirected(graph); if (graph.vertexSet().isEmpty()) { return false; } else if (graph.edgeSet().isEmpty()) { return true; } else if (graph.getType().isUndirected()) { for (V v : gr... | HierholzerEulerianCycle implements EulerianCycleAlgorithm<V, E> { public boolean isEulerian(Graph<V, E> graph) { GraphTests.requireDirectedOrUndirected(graph); if (graph.vertexSet().isEmpty()) { return false; } else if (graph.edgeSet().isEmpty()) { return true; } else if (graph.getType().isUndirected()) { for (V v : gr... | HierholzerEulerianCycle implements EulerianCycleAlgorithm<V, E> { public boolean isEulerian(Graph<V, E> graph) { GraphTests.requireDirectedOrUndirected(graph); if (graph.vertexSet().isEmpty()) { return false; } else if (graph.edgeSet().isEmpty()) { return true; } else if (graph.getType().isUndirected()) { for (V v : gr... | HierholzerEulerianCycle implements EulerianCycleAlgorithm<V, E> { public boolean isEulerian(Graph<V, E> graph) { GraphTests.requireDirectedOrUndirected(graph); if (graph.vertexSet().isEmpty()) { return false; } else if (graph.edgeSet().isEmpty()) { return true; } else if (graph.getType().isUndirected()) { for (V v : gr... |
@Test public void testDirectedEulerian1() { Graph<Integer, DefaultEdge> g1 = new SimpleDirectedGraph<>(DefaultEdge.class); CompleteGraphGenerator<Integer, DefaultEdge> gen1 = new CompleteGraphGenerator<>(6); gen1.generateGraph(g1, new IntegerVertexFactory(), null); Assert.assertTrue(new HierholzerEulerianCycle<Integer,... | public boolean isEulerian(Graph<V, E> graph) { GraphTests.requireDirectedOrUndirected(graph); if (graph.vertexSet().isEmpty()) { return false; } else if (graph.edgeSet().isEmpty()) { return true; } else if (graph.getType().isUndirected()) { for (V v : graph.vertexSet()) { if (graph.degreeOf(v) % 2 == 1) { return false;... | HierholzerEulerianCycle implements EulerianCycleAlgorithm<V, E> { public boolean isEulerian(Graph<V, E> graph) { GraphTests.requireDirectedOrUndirected(graph); if (graph.vertexSet().isEmpty()) { return false; } else if (graph.edgeSet().isEmpty()) { return true; } else if (graph.getType().isUndirected()) { for (V v : gr... | HierholzerEulerianCycle implements EulerianCycleAlgorithm<V, E> { public boolean isEulerian(Graph<V, E> graph) { GraphTests.requireDirectedOrUndirected(graph); if (graph.vertexSet().isEmpty()) { return false; } else if (graph.edgeSet().isEmpty()) { return true; } else if (graph.getType().isUndirected()) { for (V v : gr... | HierholzerEulerianCycle implements EulerianCycleAlgorithm<V, E> { public boolean isEulerian(Graph<V, E> graph) { GraphTests.requireDirectedOrUndirected(graph); if (graph.vertexSet().isEmpty()) { return false; } else if (graph.edgeSet().isEmpty()) { return true; } else if (graph.getType().isUndirected()) { for (V v : gr... | HierholzerEulerianCycle implements EulerianCycleAlgorithm<V, E> { public boolean isEulerian(Graph<V, E> graph) { GraphTests.requireDirectedOrUndirected(graph); if (graph.vertexSet().isEmpty()) { return false; } else if (graph.edgeSet().isEmpty()) { return true; } else if (graph.getType().isUndirected()) { for (V v : gr... |
@Test public void testEmptyWithSingleVertexUndirected() { Graph<Integer, DefaultEdge> g = new Pseudograph<>(DefaultEdge.class); g.addVertex(1); GraphPath<Integer, DefaultEdge> cycle = new HierholzerEulerianCycle<Integer, DefaultEdge>().getEulerianCycle(g); assertEulerian(cycle); } | public GraphPath<V, E> getEulerianCycle(Graph<V, E> g) { if (!isEulerian(g)) { throw new IllegalArgumentException("Graph is not Eulerian"); } else if (g.vertexSet().size() == 0) { throw new IllegalArgumentException("Null graph not permitted"); } else if (GraphTests.isEmpty(g)) { return GraphWalk.emptyWalk(g); } initial... | HierholzerEulerianCycle implements EulerianCycleAlgorithm<V, E> { public GraphPath<V, E> getEulerianCycle(Graph<V, E> g) { if (!isEulerian(g)) { throw new IllegalArgumentException("Graph is not Eulerian"); } else if (g.vertexSet().size() == 0) { throw new IllegalArgumentException("Null graph not permitted"); } else if ... | HierholzerEulerianCycle implements EulerianCycleAlgorithm<V, E> { public GraphPath<V, E> getEulerianCycle(Graph<V, E> g) { if (!isEulerian(g)) { throw new IllegalArgumentException("Graph is not Eulerian"); } else if (g.vertexSet().size() == 0) { throw new IllegalArgumentException("Null graph not permitted"); } else if ... | HierholzerEulerianCycle implements EulerianCycleAlgorithm<V, E> { public GraphPath<V, E> getEulerianCycle(Graph<V, E> g) { if (!isEulerian(g)) { throw new IllegalArgumentException("Graph is not Eulerian"); } else if (g.vertexSet().size() == 0) { throw new IllegalArgumentException("Null graph not permitted"); } else if ... | HierholzerEulerianCycle implements EulerianCycleAlgorithm<V, E> { public GraphPath<V, E> getEulerianCycle(Graph<V, E> g) { if (!isEulerian(g)) { throw new IllegalArgumentException("Graph is not Eulerian"); } else if (g.vertexSet().size() == 0) { throw new IllegalArgumentException("Null graph not permitted"); } else if ... |
@Test public void testEmptyMultipleVerticesUndirected() { Graph<Integer, DefaultEdge> g = new Pseudograph<>(DefaultEdge.class); g.addVertex(1); g.addVertex(2); g.addVertex(3); g.addVertex(4); g.addVertex(5); GraphPath<Integer, DefaultEdge> cycle = new HierholzerEulerianCycle<Integer, DefaultEdge>().getEulerianCycle(g);... | public GraphPath<V, E> getEulerianCycle(Graph<V, E> g) { if (!isEulerian(g)) { throw new IllegalArgumentException("Graph is not Eulerian"); } else if (g.vertexSet().size() == 0) { throw new IllegalArgumentException("Null graph not permitted"); } else if (GraphTests.isEmpty(g)) { return GraphWalk.emptyWalk(g); } initial... | HierholzerEulerianCycle implements EulerianCycleAlgorithm<V, E> { public GraphPath<V, E> getEulerianCycle(Graph<V, E> g) { if (!isEulerian(g)) { throw new IllegalArgumentException("Graph is not Eulerian"); } else if (g.vertexSet().size() == 0) { throw new IllegalArgumentException("Null graph not permitted"); } else if ... | HierholzerEulerianCycle implements EulerianCycleAlgorithm<V, E> { public GraphPath<V, E> getEulerianCycle(Graph<V, E> g) { if (!isEulerian(g)) { throw new IllegalArgumentException("Graph is not Eulerian"); } else if (g.vertexSet().size() == 0) { throw new IllegalArgumentException("Null graph not permitted"); } else if ... | HierholzerEulerianCycle implements EulerianCycleAlgorithm<V, E> { public GraphPath<V, E> getEulerianCycle(Graph<V, E> g) { if (!isEulerian(g)) { throw new IllegalArgumentException("Graph is not Eulerian"); } else if (g.vertexSet().size() == 0) { throw new IllegalArgumentException("Null graph not permitted"); } else if ... | HierholzerEulerianCycle implements EulerianCycleAlgorithm<V, E> { public GraphPath<V, E> getEulerianCycle(Graph<V, E> g) { if (!isEulerian(g)) { throw new IllegalArgumentException("Graph is not Eulerian"); } else if (g.vertexSet().size() == 0) { throw new IllegalArgumentException("Null graph not permitted"); } else if ... |
@Test public void testEmptyWithSingleVertexDirected() { Graph<Integer, DefaultEdge> g = new DirectedPseudograph<>(DefaultEdge.class); g.addVertex(1); GraphPath<Integer, DefaultEdge> cycle = new HierholzerEulerianCycle<Integer, DefaultEdge>().getEulerianCycle(g); assertEulerian(cycle); } | public GraphPath<V, E> getEulerianCycle(Graph<V, E> g) { if (!isEulerian(g)) { throw new IllegalArgumentException("Graph is not Eulerian"); } else if (g.vertexSet().size() == 0) { throw new IllegalArgumentException("Null graph not permitted"); } else if (GraphTests.isEmpty(g)) { return GraphWalk.emptyWalk(g); } initial... | HierholzerEulerianCycle implements EulerianCycleAlgorithm<V, E> { public GraphPath<V, E> getEulerianCycle(Graph<V, E> g) { if (!isEulerian(g)) { throw new IllegalArgumentException("Graph is not Eulerian"); } else if (g.vertexSet().size() == 0) { throw new IllegalArgumentException("Null graph not permitted"); } else if ... | HierholzerEulerianCycle implements EulerianCycleAlgorithm<V, E> { public GraphPath<V, E> getEulerianCycle(Graph<V, E> g) { if (!isEulerian(g)) { throw new IllegalArgumentException("Graph is not Eulerian"); } else if (g.vertexSet().size() == 0) { throw new IllegalArgumentException("Null graph not permitted"); } else if ... | HierholzerEulerianCycle implements EulerianCycleAlgorithm<V, E> { public GraphPath<V, E> getEulerianCycle(Graph<V, E> g) { if (!isEulerian(g)) { throw new IllegalArgumentException("Graph is not Eulerian"); } else if (g.vertexSet().size() == 0) { throw new IllegalArgumentException("Null graph not permitted"); } else if ... | HierholzerEulerianCycle implements EulerianCycleAlgorithm<V, E> { public GraphPath<V, E> getEulerianCycle(Graph<V, E> g) { if (!isEulerian(g)) { throw new IllegalArgumentException("Graph is not Eulerian"); } else if (g.vertexSet().size() == 0) { throw new IllegalArgumentException("Null graph not permitted"); } else if ... |
@Test public void testPseudoGraph() throws UnsupportedEncodingException, ExportException, ImportException { Graph<Integer, DefaultEdge> orig= new Pseudograph<>(DefaultEdge.class); Graphs.addAllVertices(orig, Arrays.asList(0,1,2)); orig.addEdge(0,1); orig.addEdge(0,1); orig.addEdge(1,2); orig.addEdge(2,0); orig.addEdge(... | @Override public void exportGraph(Graph<V, E> g, Writer writer) throws ExportException { GraphTests.requireUndirected(g); if(format == Format.GRAPH6 && !GraphTests.isSimple(g)) throw new ExportException("Graphs exported in graph6 format cannot contain loops or multiple edges."); List<V> vertices = new ArrayList<>(g.ver... | Graph6Sparse6Exporter implements GraphExporter<V, E> { @Override public void exportGraph(Graph<V, E> g, Writer writer) throws ExportException { GraphTests.requireUndirected(g); if(format == Format.GRAPH6 && !GraphTests.isSimple(g)) throw new ExportException("Graphs exported in graph6 format cannot contain loops or mult... | Graph6Sparse6Exporter implements GraphExporter<V, E> { @Override public void exportGraph(Graph<V, E> g, Writer writer) throws ExportException { GraphTests.requireUndirected(g); if(format == Format.GRAPH6 && !GraphTests.isSimple(g)) throw new ExportException("Graphs exported in graph6 format cannot contain loops or mult... | Graph6Sparse6Exporter implements GraphExporter<V, E> { @Override public void exportGraph(Graph<V, E> g, Writer writer) throws ExportException { GraphTests.requireUndirected(g); if(format == Format.GRAPH6 && !GraphTests.isSimple(g)) throw new ExportException("Graphs exported in graph6 format cannot contain loops or mult... | Graph6Sparse6Exporter implements GraphExporter<V, E> { @Override public void exportGraph(Graph<V, E> g, Writer writer) throws ExportException { GraphTests.requireUndirected(g); if(format == Format.GRAPH6 && !GraphTests.isSimple(g)) throw new ExportException("Graphs exported in graph6 format cannot contain loops or mult... |
@Test public void testEmptyMultipleVerticesDirected() { Graph<Integer, DefaultEdge> g = new DirectedPseudograph<>(DefaultEdge.class); g.addVertex(1); g.addVertex(2); g.addVertex(3); g.addVertex(4); g.addVertex(5); GraphPath<Integer, DefaultEdge> cycle = new HierholzerEulerianCycle<Integer, DefaultEdge>().getEulerianCyc... | public GraphPath<V, E> getEulerianCycle(Graph<V, E> g) { if (!isEulerian(g)) { throw new IllegalArgumentException("Graph is not Eulerian"); } else if (g.vertexSet().size() == 0) { throw new IllegalArgumentException("Null graph not permitted"); } else if (GraphTests.isEmpty(g)) { return GraphWalk.emptyWalk(g); } initial... | HierholzerEulerianCycle implements EulerianCycleAlgorithm<V, E> { public GraphPath<V, E> getEulerianCycle(Graph<V, E> g) { if (!isEulerian(g)) { throw new IllegalArgumentException("Graph is not Eulerian"); } else if (g.vertexSet().size() == 0) { throw new IllegalArgumentException("Null graph not permitted"); } else if ... | HierholzerEulerianCycle implements EulerianCycleAlgorithm<V, E> { public GraphPath<V, E> getEulerianCycle(Graph<V, E> g) { if (!isEulerian(g)) { throw new IllegalArgumentException("Graph is not Eulerian"); } else if (g.vertexSet().size() == 0) { throw new IllegalArgumentException("Null graph not permitted"); } else if ... | HierholzerEulerianCycle implements EulerianCycleAlgorithm<V, E> { public GraphPath<V, E> getEulerianCycle(Graph<V, E> g) { if (!isEulerian(g)) { throw new IllegalArgumentException("Graph is not Eulerian"); } else if (g.vertexSet().size() == 0) { throw new IllegalArgumentException("Null graph not permitted"); } else if ... | HierholzerEulerianCycle implements EulerianCycleAlgorithm<V, E> { public GraphPath<V, E> getEulerianCycle(Graph<V, E> g) { if (!isEulerian(g)) { throw new IllegalArgumentException("Graph is not Eulerian"); } else if (g.vertexSet().size() == 0) { throw new IllegalArgumentException("Null graph not permitted"); } else if ... |
@Test public void testOutgoing() { Graph<String, DefaultEdge> g = createInstance1(); VertexScoringAlgorithm<String, Double> pr = new ClosenessCentrality<>(g, false, true); assertEquals(4d / 7, pr.getVertexScore("1"), 1e-9); assertEquals(4d / 9, pr.getVertexScore("2"), 1e-9); assertEquals(4d / 8, pr.getVertexScore("3"),... | @Override public Double getVertexScore(V v) { if (!graph.containsVertex(v)) { throw new IllegalArgumentException("Cannot return score of unknown vertex"); } if (scores == null) { compute(); } return scores.get(v); } | ClosenessCentrality implements VertexScoringAlgorithm<V, Double> { @Override public Double getVertexScore(V v) { if (!graph.containsVertex(v)) { throw new IllegalArgumentException("Cannot return score of unknown vertex"); } if (scores == null) { compute(); } return scores.get(v); } } | ClosenessCentrality implements VertexScoringAlgorithm<V, Double> { @Override public Double getVertexScore(V v) { if (!graph.containsVertex(v)) { throw new IllegalArgumentException("Cannot return score of unknown vertex"); } if (scores == null) { compute(); } return scores.get(v); } ClosenessCentrality(Graph<V, E> graph... | ClosenessCentrality implements VertexScoringAlgorithm<V, Double> { @Override public Double getVertexScore(V v) { if (!graph.containsVertex(v)) { throw new IllegalArgumentException("Cannot return score of unknown vertex"); } if (scores == null) { compute(); } return scores.get(v); } ClosenessCentrality(Graph<V, E> graph... | ClosenessCentrality implements VertexScoringAlgorithm<V, Double> { @Override public Double getVertexScore(V v) { if (!graph.containsVertex(v)) { throw new IllegalArgumentException("Cannot return score of unknown vertex"); } if (scores == null) { compute(); } return scores.get(v); } ClosenessCentrality(Graph<V, E> graph... |
@Test public void testIncoming() { Graph<String, DefaultEdge> g = createInstance1(); VertexScoringAlgorithm<String, Double> pr = new ClosenessCentrality<>(g, true, true); assertEquals(4d / 9, pr.getVertexScore("1"), 1e-9); assertEquals(4d / 10, pr.getVertexScore("2"), 1e-9); assertEquals(4d / 5, pr.getVertexScore("3"),... | @Override public Double getVertexScore(V v) { if (!graph.containsVertex(v)) { throw new IllegalArgumentException("Cannot return score of unknown vertex"); } if (scores == null) { compute(); } return scores.get(v); } | ClosenessCentrality implements VertexScoringAlgorithm<V, Double> { @Override public Double getVertexScore(V v) { if (!graph.containsVertex(v)) { throw new IllegalArgumentException("Cannot return score of unknown vertex"); } if (scores == null) { compute(); } return scores.get(v); } } | ClosenessCentrality implements VertexScoringAlgorithm<V, Double> { @Override public Double getVertexScore(V v) { if (!graph.containsVertex(v)) { throw new IllegalArgumentException("Cannot return score of unknown vertex"); } if (scores == null) { compute(); } return scores.get(v); } ClosenessCentrality(Graph<V, E> graph... | ClosenessCentrality implements VertexScoringAlgorithm<V, Double> { @Override public Double getVertexScore(V v) { if (!graph.containsVertex(v)) { throw new IllegalArgumentException("Cannot return score of unknown vertex"); } if (scores == null) { compute(); } return scores.get(v); } ClosenessCentrality(Graph<V, E> graph... | ClosenessCentrality implements VertexScoringAlgorithm<V, Double> { @Override public Double getVertexScore(V v) { if (!graph.containsVertex(v)) { throw new IllegalArgumentException("Cannot return score of unknown vertex"); } if (scores == null) { compute(); } return scores.get(v); } ClosenessCentrality(Graph<V, E> graph... |
@Test public void testIncomingNoNormalization() { Graph<String, DefaultEdge> g = createInstance1(); VertexScoringAlgorithm<String, Double> pr = new ClosenessCentrality<>(g, true, false); assertEquals(1d / 9, pr.getVertexScore("1"), 1e-9); assertEquals(1d / 10, pr.getVertexScore("2"), 1e-9); assertEquals(1d / 5, pr.getV... | @Override public Double getVertexScore(V v) { if (!graph.containsVertex(v)) { throw new IllegalArgumentException("Cannot return score of unknown vertex"); } if (scores == null) { compute(); } return scores.get(v); } | ClosenessCentrality implements VertexScoringAlgorithm<V, Double> { @Override public Double getVertexScore(V v) { if (!graph.containsVertex(v)) { throw new IllegalArgumentException("Cannot return score of unknown vertex"); } if (scores == null) { compute(); } return scores.get(v); } } | ClosenessCentrality implements VertexScoringAlgorithm<V, Double> { @Override public Double getVertexScore(V v) { if (!graph.containsVertex(v)) { throw new IllegalArgumentException("Cannot return score of unknown vertex"); } if (scores == null) { compute(); } return scores.get(v); } ClosenessCentrality(Graph<V, E> graph... | ClosenessCentrality implements VertexScoringAlgorithm<V, Double> { @Override public Double getVertexScore(V v) { if (!graph.containsVertex(v)) { throw new IllegalArgumentException("Cannot return score of unknown vertex"); } if (scores == null) { compute(); } return scores.get(v); } ClosenessCentrality(Graph<V, E> graph... | ClosenessCentrality implements VertexScoringAlgorithm<V, Double> { @Override public Double getVertexScore(V v) { if (!graph.containsVertex(v)) { throw new IllegalArgumentException("Cannot return score of unknown vertex"); } if (scores == null) { compute(); } return scores.get(v); } ClosenessCentrality(Graph<V, E> graph... |
@Test public void testUndirected() { Graph<String, DefaultEdge> g = new AsUndirectedGraph<>(createInstance1()); VertexScoringAlgorithm<String, Double> pr1 = new ClosenessCentrality<>(g, true, true); VertexScoringAlgorithm<String, Double> pr2 = new ClosenessCentrality<>(g, false, true); assertEquals(4d / 5, pr1.getVerte... | @Override public Double getVertexScore(V v) { if (!graph.containsVertex(v)) { throw new IllegalArgumentException("Cannot return score of unknown vertex"); } if (scores == null) { compute(); } return scores.get(v); } | ClosenessCentrality implements VertexScoringAlgorithm<V, Double> { @Override public Double getVertexScore(V v) { if (!graph.containsVertex(v)) { throw new IllegalArgumentException("Cannot return score of unknown vertex"); } if (scores == null) { compute(); } return scores.get(v); } } | ClosenessCentrality implements VertexScoringAlgorithm<V, Double> { @Override public Double getVertexScore(V v) { if (!graph.containsVertex(v)) { throw new IllegalArgumentException("Cannot return score of unknown vertex"); } if (scores == null) { compute(); } return scores.get(v); } ClosenessCentrality(Graph<V, E> graph... | ClosenessCentrality implements VertexScoringAlgorithm<V, Double> { @Override public Double getVertexScore(V v) { if (!graph.containsVertex(v)) { throw new IllegalArgumentException("Cannot return score of unknown vertex"); } if (scores == null) { compute(); } return scores.get(v); } ClosenessCentrality(Graph<V, E> graph... | ClosenessCentrality implements VertexScoringAlgorithm<V, Double> { @Override public Double getVertexScore(V v) { if (!graph.containsVertex(v)) { throw new IllegalArgumentException("Cannot return score of unknown vertex"); } if (scores == null) { compute(); } return scores.get(v); } ClosenessCentrality(Graph<V, E> graph... |
@Test public void testNegativeWeights() { DirectedWeightedPseudograph<String, DefaultWeightedEdge> g = new DirectedWeightedPseudograph<>(DefaultWeightedEdge.class); g.addVertex("1"); g.addVertex("2"); g.addVertex("3"); g.addVertex("4"); g.addVertex("5"); g.addEdge("1", "2"); DefaultWeightedEdge e13 = g.addEdge("1", "3"... | @Override public Double getVertexScore(V v) { if (!graph.containsVertex(v)) { throw new IllegalArgumentException("Cannot return score of unknown vertex"); } if (scores == null) { compute(); } return scores.get(v); } | ClosenessCentrality implements VertexScoringAlgorithm<V, Double> { @Override public Double getVertexScore(V v) { if (!graph.containsVertex(v)) { throw new IllegalArgumentException("Cannot return score of unknown vertex"); } if (scores == null) { compute(); } return scores.get(v); } } | ClosenessCentrality implements VertexScoringAlgorithm<V, Double> { @Override public Double getVertexScore(V v) { if (!graph.containsVertex(v)) { throw new IllegalArgumentException("Cannot return score of unknown vertex"); } if (scores == null) { compute(); } return scores.get(v); } ClosenessCentrality(Graph<V, E> graph... | ClosenessCentrality implements VertexScoringAlgorithm<V, Double> { @Override public Double getVertexScore(V v) { if (!graph.containsVertex(v)) { throw new IllegalArgumentException("Cannot return score of unknown vertex"); } if (scores == null) { compute(); } return scores.get(v); } ClosenessCentrality(Graph<V, E> graph... | ClosenessCentrality implements VertexScoringAlgorithm<V, Double> { @Override public Double getVertexScore(V v) { if (!graph.containsVertex(v)) { throw new IllegalArgumentException("Cannot return score of unknown vertex"); } if (scores == null) { compute(); } return scores.get(v); } ClosenessCentrality(Graph<V, E> graph... |
@Test public void testDisconnectedOutgoing() { Graph<String, DefaultEdge> g = createInstance1(); g.addVertex("6"); VertexScoringAlgorithm<String, Double> pr = new ClosenessCentrality<>(g, false, true); assertEquals(0d, pr.getVertexScore("1"), 1e-9); assertEquals(0d, pr.getVertexScore("2"), 1e-9); assertEquals(0d, pr.ge... | @Override public Double getVertexScore(V v) { if (!graph.containsVertex(v)) { throw new IllegalArgumentException("Cannot return score of unknown vertex"); } if (scores == null) { compute(); } return scores.get(v); } | ClosenessCentrality implements VertexScoringAlgorithm<V, Double> { @Override public Double getVertexScore(V v) { if (!graph.containsVertex(v)) { throw new IllegalArgumentException("Cannot return score of unknown vertex"); } if (scores == null) { compute(); } return scores.get(v); } } | ClosenessCentrality implements VertexScoringAlgorithm<V, Double> { @Override public Double getVertexScore(V v) { if (!graph.containsVertex(v)) { throw new IllegalArgumentException("Cannot return score of unknown vertex"); } if (scores == null) { compute(); } return scores.get(v); } ClosenessCentrality(Graph<V, E> graph... | ClosenessCentrality implements VertexScoringAlgorithm<V, Double> { @Override public Double getVertexScore(V v) { if (!graph.containsVertex(v)) { throw new IllegalArgumentException("Cannot return score of unknown vertex"); } if (scores == null) { compute(); } return scores.get(v); } ClosenessCentrality(Graph<V, E> graph... | ClosenessCentrality implements VertexScoringAlgorithm<V, Double> { @Override public Double getVertexScore(V v) { if (!graph.containsVertex(v)) { throw new IllegalArgumentException("Cannot return score of unknown vertex"); } if (scores == null) { compute(); } return scores.get(v); } ClosenessCentrality(Graph<V, E> graph... |
@Test public void testSingletonWithNormalize() { DirectedPseudograph<String, DefaultEdge> g = new DirectedPseudograph<>(DefaultEdge.class); g.addVertex("1"); VertexScoringAlgorithm<String, Double> pr = new ClosenessCentrality<>(g, false, true); assertEquals(Double.NaN, pr.getVertexScore("1"), 1e-9); } | @Override public Double getVertexScore(V v) { if (!graph.containsVertex(v)) { throw new IllegalArgumentException("Cannot return score of unknown vertex"); } if (scores == null) { compute(); } return scores.get(v); } | ClosenessCentrality implements VertexScoringAlgorithm<V, Double> { @Override public Double getVertexScore(V v) { if (!graph.containsVertex(v)) { throw new IllegalArgumentException("Cannot return score of unknown vertex"); } if (scores == null) { compute(); } return scores.get(v); } } | ClosenessCentrality implements VertexScoringAlgorithm<V, Double> { @Override public Double getVertexScore(V v) { if (!graph.containsVertex(v)) { throw new IllegalArgumentException("Cannot return score of unknown vertex"); } if (scores == null) { compute(); } return scores.get(v); } ClosenessCentrality(Graph<V, E> graph... | ClosenessCentrality implements VertexScoringAlgorithm<V, Double> { @Override public Double getVertexScore(V v) { if (!graph.containsVertex(v)) { throw new IllegalArgumentException("Cannot return score of unknown vertex"); } if (scores == null) { compute(); } return scores.get(v); } ClosenessCentrality(Graph<V, E> graph... | ClosenessCentrality implements VertexScoringAlgorithm<V, Double> { @Override public Double getVertexScore(V v) { if (!graph.containsVertex(v)) { throw new IllegalArgumentException("Cannot return score of unknown vertex"); } if (scores == null) { compute(); } return scores.get(v); } ClosenessCentrality(Graph<V, E> graph... |
@Test public void testSingletonWithoutNormalize() { DirectedPseudograph<String, DefaultEdge> g = new DirectedPseudograph<>(DefaultEdge.class); g.addVertex("1"); VertexScoringAlgorithm<String, Double> pr = new ClosenessCentrality<>(g, false, false); assertEquals(Double.POSITIVE_INFINITY, pr.getVertexScore("1"), 1e-9); } | @Override public Double getVertexScore(V v) { if (!graph.containsVertex(v)) { throw new IllegalArgumentException("Cannot return score of unknown vertex"); } if (scores == null) { compute(); } return scores.get(v); } | ClosenessCentrality implements VertexScoringAlgorithm<V, Double> { @Override public Double getVertexScore(V v) { if (!graph.containsVertex(v)) { throw new IllegalArgumentException("Cannot return score of unknown vertex"); } if (scores == null) { compute(); } return scores.get(v); } } | ClosenessCentrality implements VertexScoringAlgorithm<V, Double> { @Override public Double getVertexScore(V v) { if (!graph.containsVertex(v)) { throw new IllegalArgumentException("Cannot return score of unknown vertex"); } if (scores == null) { compute(); } return scores.get(v); } ClosenessCentrality(Graph<V, E> graph... | ClosenessCentrality implements VertexScoringAlgorithm<V, Double> { @Override public Double getVertexScore(V v) { if (!graph.containsVertex(v)) { throw new IllegalArgumentException("Cannot return score of unknown vertex"); } if (scores == null) { compute(); } return scores.get(v); } ClosenessCentrality(Graph<V, E> graph... | ClosenessCentrality implements VertexScoringAlgorithm<V, Double> { @Override public Double getVertexScore(V v) { if (!graph.containsVertex(v)) { throw new IllegalArgumentException("Cannot return score of unknown vertex"); } if (scores == null) { compute(); } return scores.get(v); } ClosenessCentrality(Graph<V, E> graph... |
@Test public void testEmptyGraph() { SimpleGraph<String, DefaultEdge> g = new SimpleGraph<>(DefaultEdge.class); VertexScoringAlgorithm<String, Integer> pr = new Coreness<>(g); assertTrue(pr.getScores().isEmpty()); } | @Override public Map<V, Integer> getScores() { lazyRun(); return Collections.unmodifiableMap(scores); } | Coreness implements VertexScoringAlgorithm<V, Integer> { @Override public Map<V, Integer> getScores() { lazyRun(); return Collections.unmodifiableMap(scores); } } | Coreness implements VertexScoringAlgorithm<V, Integer> { @Override public Map<V, Integer> getScores() { lazyRun(); return Collections.unmodifiableMap(scores); } Coreness(Graph<V, E> g); } | Coreness implements VertexScoringAlgorithm<V, Integer> { @Override public Map<V, Integer> getScores() { lazyRun(); return Collections.unmodifiableMap(scores); } Coreness(Graph<V, E> g); @Override Map<V, Integer> getScores(); @Override Integer getVertexScore(V v); int getDegeneracy(); } | Coreness implements VertexScoringAlgorithm<V, Integer> { @Override public Map<V, Integer> getScores() { lazyRun(); return Collections.unmodifiableMap(scores); } Coreness(Graph<V, E> g); @Override Map<V, Integer> getScores(); @Override Integer getVertexScore(V v); int getDegeneracy(); } |
@Test public void testRandomGraphsS6() throws UnsupportedEncodingException, ExportException, ImportException { GnpRandomGraphGenerator<Integer, DefaultEdge> gnp=new GnpRandomGraphGenerator<>(40, .55, 0, true); for(int i=0; i<20; i++){ Graph<Integer, DefaultEdge> orig=new Pseudograph<>(DefaultEdge.class); gnp.generateGr... | @Override public void exportGraph(Graph<V, E> g, Writer writer) throws ExportException { GraphTests.requireUndirected(g); if(format == Format.GRAPH6 && !GraphTests.isSimple(g)) throw new ExportException("Graphs exported in graph6 format cannot contain loops or multiple edges."); List<V> vertices = new ArrayList<>(g.ver... | Graph6Sparse6Exporter implements GraphExporter<V, E> { @Override public void exportGraph(Graph<V, E> g, Writer writer) throws ExportException { GraphTests.requireUndirected(g); if(format == Format.GRAPH6 && !GraphTests.isSimple(g)) throw new ExportException("Graphs exported in graph6 format cannot contain loops or mult... | Graph6Sparse6Exporter implements GraphExporter<V, E> { @Override public void exportGraph(Graph<V, E> g, Writer writer) throws ExportException { GraphTests.requireUndirected(g); if(format == Format.GRAPH6 && !GraphTests.isSimple(g)) throw new ExportException("Graphs exported in graph6 format cannot contain loops or mult... | Graph6Sparse6Exporter implements GraphExporter<V, E> { @Override public void exportGraph(Graph<V, E> g, Writer writer) throws ExportException { GraphTests.requireUndirected(g); if(format == Format.GRAPH6 && !GraphTests.isSimple(g)) throw new ExportException("Graphs exported in graph6 format cannot contain loops or mult... | Graph6Sparse6Exporter implements GraphExporter<V, E> { @Override public void exportGraph(Graph<V, E> g, Writer writer) throws ExportException { GraphTests.requireUndirected(g); if(format == Format.GRAPH6 && !GraphTests.isSimple(g)) throw new ExportException("Graphs exported in graph6 format cannot contain loops or mult... |
@Test public void testWithMapsFromDirectoryXml() { ConceptMaps maps = ConceptMaps.getEmpty(spark) .withMapsFromDirectory("src/test/resources/xml/conceptmaps"); ConceptMap genderMap = maps.getConceptMap( "urn:cerner:poprec:fhir:conceptmap:demographics:gender", "0.0.1"); Assert.assertNotNull(genderMap); Assert.assertEqua... | public static ConceptMaps getEmpty(SparkSession spark) { Dataset<ConceptMap> emptyConceptMaps = spark.emptyDataset(CONCEPT_MAP_ENCODER) .withColumn("timestamp", lit(null).cast("timestamp")) .as(CONCEPT_MAP_ENCODER); return new ConceptMaps(spark, spark.emptyDataset(URL_AND_VERSION_ENCODER), emptyConceptMaps, spark.empty... | ConceptMaps extends AbstractConceptMaps<ConceptMap, ConceptMaps> { public static ConceptMaps getEmpty(SparkSession spark) { Dataset<ConceptMap> emptyConceptMaps = spark.emptyDataset(CONCEPT_MAP_ENCODER) .withColumn("timestamp", lit(null).cast("timestamp")) .as(CONCEPT_MAP_ENCODER); return new ConceptMaps(spark, spark.e... | ConceptMaps extends AbstractConceptMaps<ConceptMap, ConceptMaps> { public static ConceptMaps getEmpty(SparkSession spark) { Dataset<ConceptMap> emptyConceptMaps = spark.emptyDataset(CONCEPT_MAP_ENCODER) .withColumn("timestamp", lit(null).cast("timestamp")) .as(CONCEPT_MAP_ENCODER); return new ConceptMaps(spark, spark.e... | ConceptMaps extends AbstractConceptMaps<ConceptMap, ConceptMaps> { public static ConceptMaps getEmpty(SparkSession spark) { Dataset<ConceptMap> emptyConceptMaps = spark.emptyDataset(CONCEPT_MAP_ENCODER) .withColumn("timestamp", lit(null).cast("timestamp")) .as(CONCEPT_MAP_ENCODER); return new ConceptMaps(spark, spark.e... | ConceptMaps extends AbstractConceptMaps<ConceptMap, ConceptMaps> { public static ConceptMaps getEmpty(SparkSession spark) { Dataset<ConceptMap> emptyConceptMaps = spark.emptyDataset(CONCEPT_MAP_ENCODER) .withColumn("timestamp", lit(null).cast("timestamp")) .as(CONCEPT_MAP_ENCODER); return new ConceptMaps(spark, spark.e... |
@Test public void testExpandMappings() { ConceptMap conceptMap = ConceptMaps.getEmpty(spark) .withConceptMaps(conceptMap("urn:cerner:conceptmap:map", "1")) .getConceptMap("urn:cerner:conceptmap:map", "1"); List<Mapping> mappings = ConceptMaps.expandMappings(conceptMap); Mapping expectedValue = new Mapping("urn:cerner:c... | public static List<Mapping> expandMappings(ConceptMap map) { List<Mapping> mappings = new ArrayList<>(); expandMappingsIterator(map).forEachRemaining(mappings::add); return mappings; } | ConceptMaps extends AbstractConceptMaps<ConceptMap, ConceptMaps> { public static List<Mapping> expandMappings(ConceptMap map) { List<Mapping> mappings = new ArrayList<>(); expandMappingsIterator(map).forEachRemaining(mappings::add); return mappings; } } | ConceptMaps extends AbstractConceptMaps<ConceptMap, ConceptMaps> { public static List<Mapping> expandMappings(ConceptMap map) { List<Mapping> mappings = new ArrayList<>(); expandMappingsIterator(map).forEachRemaining(mappings::add); return mappings; } protected ConceptMaps(SparkSession spark,
Dataset<UrlAndVersi... | ConceptMaps extends AbstractConceptMaps<ConceptMap, ConceptMaps> { public static List<Mapping> expandMappings(ConceptMap map) { List<Mapping> mappings = new ArrayList<>(); expandMappingsIterator(map).forEachRemaining(mappings::add); return mappings; } protected ConceptMaps(SparkSession spark,
Dataset<UrlAndVersi... | ConceptMaps extends AbstractConceptMaps<ConceptMap, ConceptMaps> { public static List<Mapping> expandMappings(ConceptMap map) { List<Mapping> mappings = new ArrayList<>(); expandMappingsIterator(map).forEachRemaining(mappings::add); return mappings; } protected ConceptMaps(SparkSession spark,
Dataset<UrlAndVersi... |
@Test public void testWithValueSetsFromDirectoryXml() { ValueSets valueSets = ValueSets.getEmpty(spark) .withValueSetsFromDirectory("src/test/resources/xml/valuesets"); ValueSet marriedValueSet = valueSets.getValueSet( "urn:cerner:bunsen:valueset:married_maritalstatus", "0.0.1"); Assert.assertNotNull(marriedValueSet); ... | public static ValueSets getEmpty(SparkSession spark) { Dataset<Row> emptyValueSets = valuesetRowConverter.emptyDataFrame(spark) .withColumn("timestamp", lit(null).cast("timestamp")); return new ValueSets(spark, spark.emptyDataset(URL_AND_VERSION_ENCODER), emptyValueSets, spark.emptyDataset(getValueEncoder())); } | ValueSets extends AbstractValueSets<ValueSet, ValueSets> { public static ValueSets getEmpty(SparkSession spark) { Dataset<Row> emptyValueSets = valuesetRowConverter.emptyDataFrame(spark) .withColumn("timestamp", lit(null).cast("timestamp")); return new ValueSets(spark, spark.emptyDataset(URL_AND_VERSION_ENCODER), empty... | ValueSets extends AbstractValueSets<ValueSet, ValueSets> { public static ValueSets getEmpty(SparkSession spark) { Dataset<Row> emptyValueSets = valuesetRowConverter.emptyDataFrame(spark) .withColumn("timestamp", lit(null).cast("timestamp")); return new ValueSets(spark, spark.emptyDataset(URL_AND_VERSION_ENCODER), empty... | ValueSets extends AbstractValueSets<ValueSet, ValueSets> { public static ValueSets getEmpty(SparkSession spark) { Dataset<Row> emptyValueSets = valuesetRowConverter.emptyDataFrame(spark) .withColumn("timestamp", lit(null).cast("timestamp")); return new ValueSets(spark, spark.emptyDataset(URL_AND_VERSION_ENCODER), empty... | ValueSets extends AbstractValueSets<ValueSet, ValueSets> { public static ValueSets getEmpty(SparkSession spark) { Dataset<Row> emptyValueSets = valuesetRowConverter.emptyDataFrame(spark) .withColumn("timestamp", lit(null).cast("timestamp")); return new ValueSets(spark, spark.emptyDataset(URL_AND_VERSION_ENCODER), empty... |
@Test public void testWithValueSetsFromDirectoryJson() { ValueSets valueSets = ValueSets.getEmpty(spark) .withValueSetsFromDirectory("src/test/resources/json/valuesets"); ValueSet marriedValueSet = valueSets.getValueSet( "urn:cerner:bunsen:valueset:married_maritalstatus", "0.0.1"); Assert.assertNotNull(marriedValueSet)... | public static ValueSets getEmpty(SparkSession spark) { Dataset<Row> emptyValueSets = valuesetRowConverter.emptyDataFrame(spark) .withColumn("timestamp", lit(null).cast("timestamp")); return new ValueSets(spark, spark.emptyDataset(URL_AND_VERSION_ENCODER), emptyValueSets, spark.emptyDataset(getValueEncoder())); } | ValueSets extends AbstractValueSets<ValueSet, ValueSets> { public static ValueSets getEmpty(SparkSession spark) { Dataset<Row> emptyValueSets = valuesetRowConverter.emptyDataFrame(spark) .withColumn("timestamp", lit(null).cast("timestamp")); return new ValueSets(spark, spark.emptyDataset(URL_AND_VERSION_ENCODER), empty... | ValueSets extends AbstractValueSets<ValueSet, ValueSets> { public static ValueSets getEmpty(SparkSession spark) { Dataset<Row> emptyValueSets = valuesetRowConverter.emptyDataFrame(spark) .withColumn("timestamp", lit(null).cast("timestamp")); return new ValueSets(spark, spark.emptyDataset(URL_AND_VERSION_ENCODER), empty... | ValueSets extends AbstractValueSets<ValueSet, ValueSets> { public static ValueSets getEmpty(SparkSession spark) { Dataset<Row> emptyValueSets = valuesetRowConverter.emptyDataFrame(spark) .withColumn("timestamp", lit(null).cast("timestamp")); return new ValueSets(spark, spark.emptyDataset(URL_AND_VERSION_ENCODER), empty... | ValueSets extends AbstractValueSets<ValueSet, ValueSets> { public static ValueSets getEmpty(SparkSession spark) { Dataset<Row> emptyValueSets = valuesetRowConverter.emptyDataFrame(spark) .withColumn("timestamp", lit(null).cast("timestamp")); return new ValueSets(spark, spark.emptyDataset(URL_AND_VERSION_ENCODER), empty... |
@Test public void testExpandValues() { ValueSet valueSet = ValueSets.getEmpty(spark) .withValueSets(valueSet("urn:cerner:valueset:valueset", "1")) .getValueSet("urn:cerner:valueset:valueset", "1"); List<Value> values = ValueSets.expandValues(valueSet); Value expectedValue = new Value("urn:cerner:valueset:valueset", "1"... | public static List<Value> expandValues(ValueSet valueSet) { List<Value> values = new ArrayList<>(); expandValuesIterator(valueSet).forEachRemaining(values::add); return values; } | ValueSets extends AbstractValueSets<ValueSet, ValueSets> { public static List<Value> expandValues(ValueSet valueSet) { List<Value> values = new ArrayList<>(); expandValuesIterator(valueSet).forEachRemaining(values::add); return values; } } | ValueSets extends AbstractValueSets<ValueSet, ValueSets> { public static List<Value> expandValues(ValueSet valueSet) { List<Value> values = new ArrayList<>(); expandValuesIterator(valueSet).forEachRemaining(values::add); return values; } private ValueSets(SparkSession spark,
Dataset<UrlAndVersion> members,
... | ValueSets extends AbstractValueSets<ValueSet, ValueSets> { public static List<Value> expandValues(ValueSet valueSet) { List<Value> values = new ArrayList<>(); expandValuesIterator(valueSet).forEachRemaining(values::add); return values; } private ValueSets(SparkSession spark,
Dataset<UrlAndVersion> members,
... | ValueSets extends AbstractValueSets<ValueSet, ValueSets> { public static List<Value> expandValues(ValueSet valueSet) { List<Value> values = new ArrayList<>(); expandValuesIterator(valueSet).forEachRemaining(values::add); return values; } private ValueSets(SparkSession spark,
Dataset<UrlAndVersion> members,
... |
@Test public void resourceToJson() { Dataset<String> jsonDs = Functions.toJson(conditions, "Condition"); String conditionJson = jsonDs.first(); Condition parsedCondition = (Condition) CONTEXT.newJsonParser() .parseResource(conditionJson); Assert.assertEquals(condition.getId(), parsedCondition.getId()); } | public static String resourceToJson(Resource resource) { IParser parser = CONTEXT.newJsonParser(); return parser.encodeResourceToString(resource); } | Functions { public static String resourceToJson(Resource resource) { IParser parser = CONTEXT.newJsonParser(); return parser.encodeResourceToString(resource); } } | Functions { public static String resourceToJson(Resource resource) { IParser parser = CONTEXT.newJsonParser(); return parser.encodeResourceToString(resource); } } | Functions { public static String resourceToJson(Resource resource) { IParser parser = CONTEXT.newJsonParser(); return parser.encodeResourceToString(resource); } static Dataset<String> toJson(Dataset<Row> dataset, String resourceTypeUrl); static Bundle toBundle(Dataset<Row> dataset,
String resourceTypeUrl); stati... | Functions { public static String resourceToJson(Resource resource) { IParser parser = CONTEXT.newJsonParser(); return parser.encodeResourceToString(resource); } static Dataset<String> toJson(Dataset<Row> dataset, String resourceTypeUrl); static Bundle toBundle(Dataset<Row> dataset,
String resourceTypeUrl); stati... |
@Test public void bundleToJson() { String jsonBundle = Functions.toJsonBundle(conditions, "Condition"); Bundle bundle = (Bundle) CONTEXT.newJsonParser().parseResource(jsonBundle); Condition parsedCondition = (Condition) bundle.getEntryFirstRep().getResource(); Assert.assertEquals(condition.getId(), parsedCondition.getI... | public static String toJsonBundle(Dataset<Row> dataset, String resourceTypeUrl) { Bundle bundle = toBundle(dataset, resourceTypeUrl); return CONTEXT.newJsonParser().encodeResourceToString(bundle); } | Functions { public static String toJsonBundle(Dataset<Row> dataset, String resourceTypeUrl) { Bundle bundle = toBundle(dataset, resourceTypeUrl); return CONTEXT.newJsonParser().encodeResourceToString(bundle); } } | Functions { public static String toJsonBundle(Dataset<Row> dataset, String resourceTypeUrl) { Bundle bundle = toBundle(dataset, resourceTypeUrl); return CONTEXT.newJsonParser().encodeResourceToString(bundle); } } | Functions { public static String toJsonBundle(Dataset<Row> dataset, String resourceTypeUrl) { Bundle bundle = toBundle(dataset, resourceTypeUrl); return CONTEXT.newJsonParser().encodeResourceToString(bundle); } static Dataset<String> toJson(Dataset<Row> dataset, String resourceTypeUrl); static Bundle toBundle(Dataset<... | Functions { public static String toJsonBundle(Dataset<Row> dataset, String resourceTypeUrl) { Bundle bundle = toBundle(dataset, resourceTypeUrl); return CONTEXT.newJsonParser().encodeResourceToString(bundle); } static Dataset<String> toJson(Dataset<Row> dataset, String resourceTypeUrl); static Bundle toBundle(Dataset<... |
@Test public void testWriteSchema() throws IOException { Path generatedCodePath = Files.createTempDirectory("schema_directory"); generatedCodePath.toFile().deleteOnExit(); Path outputFile = generatedCodePath.resolve("out.asvc"); int result = GenerateSchemas.main(new String[] {outputFile.toString(), TestData.US_CORE_PAT... | public static int main(String[] args) { if (args.length < 2) { System.out.println("Usage: GenerateSchemas <output file> resourceTypeUrls..."); System.out.println("Example:"); System.out.println(" GenerateSchemas my_schemas.avsc " + "http: + "http: System.out.println(); System.out.println("The resulting avsc file then c... | GenerateSchemas { public static int main(String[] args) { if (args.length < 2) { System.out.println("Usage: GenerateSchemas <output file> resourceTypeUrls..."); System.out.println("Example:"); System.out.println(" GenerateSchemas my_schemas.avsc " + "http: + "http: System.out.println(); System.out.println("The resultin... | GenerateSchemas { public static int main(String[] args) { if (args.length < 2) { System.out.println("Usage: GenerateSchemas <output file> resourceTypeUrls..."); System.out.println("Example:"); System.out.println(" GenerateSchemas my_schemas.avsc " + "http: + "http: System.out.println(); System.out.println("The resultin... | GenerateSchemas { public static int main(String[] args) { if (args.length < 2) { System.out.println("Usage: GenerateSchemas <output file> resourceTypeUrls..."); System.out.println("Example:"); System.out.println(" GenerateSchemas my_schemas.avsc " + "http: + "http: System.out.println(); System.out.println("The resultin... | GenerateSchemas { public static int main(String[] args) { if (args.length < 2) { System.out.println("Usage: GenerateSchemas <output file> resourceTypeUrls..."); System.out.println("Example:"); System.out.println(" GenerateSchemas my_schemas.avsc " + "http: + "http: System.out.println(); System.out.println("The resultin... |
@Test public void testCompile() throws IOException { List<Schema> schemas = AvroConverter.generateSchemas(FhirContexts.forStu3(), ImmutableMap.of(TestData.US_CORE_PATIENT, Collections.emptyList(), TestData.VALUE_SET, Collections.emptyList(), TestData.US_CORE_MEDICATION_REQUEST, ImmutableList.of(TestData.US_CORE_MEDICAT... | public static List<Schema> generateSchemas(FhirContext context, Map<String, List<String>> resourceTypeUrls) { StructureDefinitions structureDefinitions = StructureDefinitions.create(context); Map<String, HapiConverter<Schema>> converters = new HashMap<>(); for (Entry<String, List<String>> resourceTypeUrlEntry: resource... | AvroConverter { public static List<Schema> generateSchemas(FhirContext context, Map<String, List<String>> resourceTypeUrls) { StructureDefinitions structureDefinitions = StructureDefinitions.create(context); Map<String, HapiConverter<Schema>> converters = new HashMap<>(); for (Entry<String, List<String>> resourceTypeUr... | AvroConverter { public static List<Schema> generateSchemas(FhirContext context, Map<String, List<String>> resourceTypeUrls) { StructureDefinitions structureDefinitions = StructureDefinitions.create(context); Map<String, HapiConverter<Schema>> converters = new HashMap<>(); for (Entry<String, List<String>> resourceTypeUr... | AvroConverter { public static List<Schema> generateSchemas(FhirContext context, Map<String, List<String>> resourceTypeUrls) { StructureDefinitions structureDefinitions = StructureDefinitions.create(context); Map<String, HapiConverter<Schema>> converters = new HashMap<>(); for (Entry<String, List<String>> resourceTypeUr... | AvroConverter { public static List<Schema> generateSchemas(FhirContext context, Map<String, List<String>> resourceTypeUrls) { StructureDefinitions structureDefinitions = StructureDefinitions.create(context); Map<String, HapiConverter<Schema>> converters = new HashMap<>(); for (Entry<String, List<String>> resourceTypeUr... |
@Test public void testWithMapsFromDirectoryJson() { ConceptMaps maps = ConceptMaps.getEmpty(spark) .withMapsFromDirectory("src/test/resources/json/conceptmaps"); ConceptMap genderMap = maps.getConceptMap( "urn:cerner:poprec:fhir:conceptmap:demographics:gender", "0.0.1"); Assert.assertNotNull(genderMap); Assert.assertEq... | public static ConceptMaps getEmpty(SparkSession spark) { Dataset<ConceptMap> emptyConceptMaps = spark.emptyDataset(CONCEPT_MAP_ENCODER) .withColumn("timestamp", lit(null).cast("timestamp")) .as(CONCEPT_MAP_ENCODER); return new ConceptMaps(spark, spark.emptyDataset(URL_AND_VERSION_ENCODER), emptyConceptMaps, spark.empty... | ConceptMaps extends AbstractConceptMaps<ConceptMap, ConceptMaps> { public static ConceptMaps getEmpty(SparkSession spark) { Dataset<ConceptMap> emptyConceptMaps = spark.emptyDataset(CONCEPT_MAP_ENCODER) .withColumn("timestamp", lit(null).cast("timestamp")) .as(CONCEPT_MAP_ENCODER); return new ConceptMaps(spark, spark.e... | ConceptMaps extends AbstractConceptMaps<ConceptMap, ConceptMaps> { public static ConceptMaps getEmpty(SparkSession spark) { Dataset<ConceptMap> emptyConceptMaps = spark.emptyDataset(CONCEPT_MAP_ENCODER) .withColumn("timestamp", lit(null).cast("timestamp")) .as(CONCEPT_MAP_ENCODER); return new ConceptMaps(spark, spark.e... | ConceptMaps extends AbstractConceptMaps<ConceptMap, ConceptMaps> { public static ConceptMaps getEmpty(SparkSession spark) { Dataset<ConceptMap> emptyConceptMaps = spark.emptyDataset(CONCEPT_MAP_ENCODER) .withColumn("timestamp", lit(null).cast("timestamp")) .as(CONCEPT_MAP_ENCODER); return new ConceptMaps(spark, spark.e... | ConceptMaps extends AbstractConceptMaps<ConceptMap, ConceptMaps> { public static ConceptMaps getEmpty(SparkSession spark) { Dataset<ConceptMap> emptyConceptMaps = spark.emptyDataset(CONCEPT_MAP_ENCODER) .withColumn("timestamp", lit(null).cast("timestamp")) .as(CONCEPT_MAP_ENCODER); return new ConceptMaps(spark, spark.e... |
@Test public void testExpandMappings() { ConceptMap conceptMap = ConceptMaps.getEmpty(spark) .withConceptMaps(conceptMap("urn:cerner:conceptmap:map", "1")) .getConceptMap("urn:cerner:conceptmap:map", "1"); List<Mapping> mappings = ConceptMaps.expandMappings(conceptMap); Mapping expectedValue = new Mapping("urn:cerner:c... | public static List<Mapping> expandMappings(ConceptMap map) { List<Mapping> mappings = new ArrayList<>(); expandMappingsIterator(map).forEachRemaining(mappings::add); return mappings; } | ConceptMaps extends AbstractConceptMaps<ConceptMap, ConceptMaps> { public static List<Mapping> expandMappings(ConceptMap map) { List<Mapping> mappings = new ArrayList<>(); expandMappingsIterator(map).forEachRemaining(mappings::add); return mappings; } } | ConceptMaps extends AbstractConceptMaps<ConceptMap, ConceptMaps> { public static List<Mapping> expandMappings(ConceptMap map) { List<Mapping> mappings = new ArrayList<>(); expandMappingsIterator(map).forEachRemaining(mappings::add); return mappings; } protected ConceptMaps(SparkSession spark,
Dataset<UrlAndVersi... | ConceptMaps extends AbstractConceptMaps<ConceptMap, ConceptMaps> { public static List<Mapping> expandMappings(ConceptMap map) { List<Mapping> mappings = new ArrayList<>(); expandMappingsIterator(map).forEachRemaining(mappings::add); return mappings; } protected ConceptMaps(SparkSession spark,
Dataset<UrlAndVersi... | ConceptMaps extends AbstractConceptMaps<ConceptMap, ConceptMaps> { public static List<Mapping> expandMappings(ConceptMap map) { List<Mapping> mappings = new ArrayList<>(); expandMappingsIterator(map).forEachRemaining(mappings::add); return mappings; } protected ConceptMaps(SparkSession spark,
Dataset<UrlAndVersi... |
@Test public void testWithValueSetsFromDirectoryXml() { ValueSets valueSets = ValueSets.getEmpty(spark) .withValueSetsFromDirectory("src/test/resources/xml/valuesets"); ValueSet marriedValueSet = valueSets.getValueSet( "urn:cerner:bunsen:valueset:married_maritalstatus", "0.0.1"); Assert.assertNotNull(marriedValueSet); ... | public static ValueSets getEmpty(SparkSession spark) { Dataset<ValueSet> emptyValueSets = spark.emptyDataset(VALUE_SET_ENCODER) .withColumn("timestamp", lit(null).cast("timestamp")) .as(VALUE_SET_ENCODER); return new ValueSets(spark, spark.emptyDataset(URL_AND_VERSION_ENCODER), emptyValueSets, spark.emptyDataset(getVal... | ValueSets extends AbstractValueSets<ValueSet, ValueSets> { public static ValueSets getEmpty(SparkSession spark) { Dataset<ValueSet> emptyValueSets = spark.emptyDataset(VALUE_SET_ENCODER) .withColumn("timestamp", lit(null).cast("timestamp")) .as(VALUE_SET_ENCODER); return new ValueSets(spark, spark.emptyDataset(URL_AND_... | ValueSets extends AbstractValueSets<ValueSet, ValueSets> { public static ValueSets getEmpty(SparkSession spark) { Dataset<ValueSet> emptyValueSets = spark.emptyDataset(VALUE_SET_ENCODER) .withColumn("timestamp", lit(null).cast("timestamp")) .as(VALUE_SET_ENCODER); return new ValueSets(spark, spark.emptyDataset(URL_AND_... | ValueSets extends AbstractValueSets<ValueSet, ValueSets> { public static ValueSets getEmpty(SparkSession spark) { Dataset<ValueSet> emptyValueSets = spark.emptyDataset(VALUE_SET_ENCODER) .withColumn("timestamp", lit(null).cast("timestamp")) .as(VALUE_SET_ENCODER); return new ValueSets(spark, spark.emptyDataset(URL_AND_... | ValueSets extends AbstractValueSets<ValueSet, ValueSets> { public static ValueSets getEmpty(SparkSession spark) { Dataset<ValueSet> emptyValueSets = spark.emptyDataset(VALUE_SET_ENCODER) .withColumn("timestamp", lit(null).cast("timestamp")) .as(VALUE_SET_ENCODER); return new ValueSets(spark, spark.emptyDataset(URL_AND_... |
@Test public void testWithValueSetsFromDirectoryJson() { ValueSets valueSets = ValueSets.getEmpty(spark) .withValueSetsFromDirectory("src/test/resources/json/valuesets"); ValueSet marriedValueSet = valueSets.getValueSet( "urn:cerner:bunsen:valueset:married_maritalstatus", "0.0.1"); Assert.assertNotNull(marriedValueSet)... | public static ValueSets getEmpty(SparkSession spark) { Dataset<ValueSet> emptyValueSets = spark.emptyDataset(VALUE_SET_ENCODER) .withColumn("timestamp", lit(null).cast("timestamp")) .as(VALUE_SET_ENCODER); return new ValueSets(spark, spark.emptyDataset(URL_AND_VERSION_ENCODER), emptyValueSets, spark.emptyDataset(getVal... | ValueSets extends AbstractValueSets<ValueSet, ValueSets> { public static ValueSets getEmpty(SparkSession spark) { Dataset<ValueSet> emptyValueSets = spark.emptyDataset(VALUE_SET_ENCODER) .withColumn("timestamp", lit(null).cast("timestamp")) .as(VALUE_SET_ENCODER); return new ValueSets(spark, spark.emptyDataset(URL_AND_... | ValueSets extends AbstractValueSets<ValueSet, ValueSets> { public static ValueSets getEmpty(SparkSession spark) { Dataset<ValueSet> emptyValueSets = spark.emptyDataset(VALUE_SET_ENCODER) .withColumn("timestamp", lit(null).cast("timestamp")) .as(VALUE_SET_ENCODER); return new ValueSets(spark, spark.emptyDataset(URL_AND_... | ValueSets extends AbstractValueSets<ValueSet, ValueSets> { public static ValueSets getEmpty(SparkSession spark) { Dataset<ValueSet> emptyValueSets = spark.emptyDataset(VALUE_SET_ENCODER) .withColumn("timestamp", lit(null).cast("timestamp")) .as(VALUE_SET_ENCODER); return new ValueSets(spark, spark.emptyDataset(URL_AND_... | ValueSets extends AbstractValueSets<ValueSet, ValueSets> { public static ValueSets getEmpty(SparkSession spark) { Dataset<ValueSet> emptyValueSets = spark.emptyDataset(VALUE_SET_ENCODER) .withColumn("timestamp", lit(null).cast("timestamp")) .as(VALUE_SET_ENCODER); return new ValueSets(spark, spark.emptyDataset(URL_AND_... |
@Test public void testExpandValues() { ValueSet valueSet = ValueSets.getEmpty(spark) .withValueSets(valueSet("urn:cerner:valueset:valueset", "1")) .getValueSet("urn:cerner:valueset:valueset", "1"); List<Value> values = ValueSets.expandValues(valueSet); Value expectedValue = new Value("urn:cerner:valueset:valueset", "1"... | public static List<Value> expandValues(ValueSet valueSet) { List<Value> values = new ArrayList<>(); expandValuesIterator(valueSet).forEachRemaining(values::add); return values; } | ValueSets extends AbstractValueSets<ValueSet, ValueSets> { public static List<Value> expandValues(ValueSet valueSet) { List<Value> values = new ArrayList<>(); expandValuesIterator(valueSet).forEachRemaining(values::add); return values; } } | ValueSets extends AbstractValueSets<ValueSet, ValueSets> { public static List<Value> expandValues(ValueSet valueSet) { List<Value> values = new ArrayList<>(); expandValuesIterator(valueSet).forEachRemaining(values::add); return values; } private ValueSets(SparkSession spark,
Dataset<UrlAndVersion> members,
... | ValueSets extends AbstractValueSets<ValueSet, ValueSets> { public static List<Value> expandValues(ValueSet valueSet) { List<Value> values = new ArrayList<>(); expandValuesIterator(valueSet).forEachRemaining(values::add); return values; } private ValueSets(SparkSession spark,
Dataset<UrlAndVersion> members,
... | ValueSets extends AbstractValueSets<ValueSet, ValueSets> { public static List<Value> expandValues(ValueSet valueSet) { List<Value> values = new ArrayList<>(); expandValuesIterator(valueSet).forEachRemaining(values::add); return values; } private ValueSets(SparkSession spark,
Dataset<UrlAndVersion> members,
... |
@Test public void resourceToJson() { Dataset<String> jsonDs = Functions.toJson(conditions, "condition"); String conditionJson = jsonDs.first(); Condition parsedCondition = (Condition) CONTEXT.newJsonParser() .parseResource(conditionJson); Assert.assertEquals(condition.getId(), parsedCondition.getId()); } | public static String resourceToJson(Resource resource) { IParser parser = CONTEXT.newJsonParser(); return parser.encodeResourceToString(resource); } | Functions { public static String resourceToJson(Resource resource) { IParser parser = CONTEXT.newJsonParser(); return parser.encodeResourceToString(resource); } } | Functions { public static String resourceToJson(Resource resource) { IParser parser = CONTEXT.newJsonParser(); return parser.encodeResourceToString(resource); } } | Functions { public static String resourceToJson(Resource resource) { IParser parser = CONTEXT.newJsonParser(); return parser.encodeResourceToString(resource); } static Dataset<String> toJson(Dataset<?> dataset, String resourceType); static Bundle toBundle(Dataset<? extends Resource> dataset); static String toJsonBundl... | Functions { public static String resourceToJson(Resource resource) { IParser parser = CONTEXT.newJsonParser(); return parser.encodeResourceToString(resource); } static Dataset<String> toJson(Dataset<?> dataset, String resourceType); static Bundle toBundle(Dataset<? extends Resource> dataset); static String toJsonBundl... |
@Test public void bundleToJson() { String jsonBundle = Functions.toJsonBundle(conditions); Bundle bundle = (Bundle) CONTEXT.newJsonParser().parseResource(jsonBundle); Condition parsedCondition = (Condition) bundle.getEntryFirstRep().getResource(); Assert.assertEquals(condition.getId(), parsedCondition.getId()); } | public static String toJsonBundle(Dataset<? extends Resource> dataset) { Bundle bundle = toBundle(dataset); return CONTEXT.newJsonParser().encodeResourceToString(bundle); } | Functions { public static String toJsonBundle(Dataset<? extends Resource> dataset) { Bundle bundle = toBundle(dataset); return CONTEXT.newJsonParser().encodeResourceToString(bundle); } } | Functions { public static String toJsonBundle(Dataset<? extends Resource> dataset) { Bundle bundle = toBundle(dataset); return CONTEXT.newJsonParser().encodeResourceToString(bundle); } } | Functions { public static String toJsonBundle(Dataset<? extends Resource> dataset) { Bundle bundle = toBundle(dataset); return CONTEXT.newJsonParser().encodeResourceToString(bundle); } static Dataset<String> toJson(Dataset<?> dataset, String resourceType); static Bundle toBundle(Dataset<? extends Resource> dataset); s... | Functions { public static String toJsonBundle(Dataset<? extends Resource> dataset) { Bundle bundle = toBundle(dataset); return CONTEXT.newJsonParser().encodeResourceToString(bundle); } static Dataset<String> toJson(Dataset<?> dataset, String resourceType); static Bundle toBundle(Dataset<? extends Resource> dataset); s... |
@Test public void testWithMapsFromDirectoryXml() { ConceptMaps maps = ConceptMaps.getEmpty(spark) .withMapsFromDirectory("src/test/resources/xml/conceptmaps"); ConceptMap genderMap = maps.getConceptMap( "urn:cerner:poprec:fhir:conceptmap:demographics:gender", "0.0.1"); Assert.assertNotNull(genderMap); Assert.assertEqua... | public static ConceptMaps getEmpty(SparkSession spark) { Dataset<Row> emptyConceptMaps = conceptMapConverter.emptyDataFrame(spark) .withColumn("timestamp", lit(null).cast("timestamp")); return new ConceptMaps(spark, spark.emptyDataset(URL_AND_VERSION_ENCODER), emptyConceptMaps, spark.emptyDataset(MAPPING_ENCODER)); } | ConceptMaps extends AbstractConceptMaps<ConceptMap, ConceptMaps> { public static ConceptMaps getEmpty(SparkSession spark) { Dataset<Row> emptyConceptMaps = conceptMapConverter.emptyDataFrame(spark) .withColumn("timestamp", lit(null).cast("timestamp")); return new ConceptMaps(spark, spark.emptyDataset(URL_AND_VERSION_EN... | ConceptMaps extends AbstractConceptMaps<ConceptMap, ConceptMaps> { public static ConceptMaps getEmpty(SparkSession spark) { Dataset<Row> emptyConceptMaps = conceptMapConverter.emptyDataFrame(spark) .withColumn("timestamp", lit(null).cast("timestamp")); return new ConceptMaps(spark, spark.emptyDataset(URL_AND_VERSION_EN... | ConceptMaps extends AbstractConceptMaps<ConceptMap, ConceptMaps> { public static ConceptMaps getEmpty(SparkSession spark) { Dataset<Row> emptyConceptMaps = conceptMapConverter.emptyDataFrame(spark) .withColumn("timestamp", lit(null).cast("timestamp")); return new ConceptMaps(spark, spark.emptyDataset(URL_AND_VERSION_EN... | ConceptMaps extends AbstractConceptMaps<ConceptMap, ConceptMaps> { public static ConceptMaps getEmpty(SparkSession spark) { Dataset<Row> emptyConceptMaps = conceptMapConverter.emptyDataFrame(spark) .withColumn("timestamp", lit(null).cast("timestamp")); return new ConceptMaps(spark, spark.emptyDataset(URL_AND_VERSION_EN... |
@Test public void testWithMapsFromDirectoryJson() { ConceptMaps maps = ConceptMaps.getEmpty(spark) .withMapsFromDirectory("src/test/resources/json/conceptmaps"); ConceptMap genderMap = maps.getConceptMap( "urn:cerner:poprec:fhir:conceptmap:demographics:gender", "0.0.1"); Assert.assertNotNull(genderMap); Assert.assertEq... | public static ConceptMaps getEmpty(SparkSession spark) { Dataset<Row> emptyConceptMaps = conceptMapConverter.emptyDataFrame(spark) .withColumn("timestamp", lit(null).cast("timestamp")); return new ConceptMaps(spark, spark.emptyDataset(URL_AND_VERSION_ENCODER), emptyConceptMaps, spark.emptyDataset(MAPPING_ENCODER)); } | ConceptMaps extends AbstractConceptMaps<ConceptMap, ConceptMaps> { public static ConceptMaps getEmpty(SparkSession spark) { Dataset<Row> emptyConceptMaps = conceptMapConverter.emptyDataFrame(spark) .withColumn("timestamp", lit(null).cast("timestamp")); return new ConceptMaps(spark, spark.emptyDataset(URL_AND_VERSION_EN... | ConceptMaps extends AbstractConceptMaps<ConceptMap, ConceptMaps> { public static ConceptMaps getEmpty(SparkSession spark) { Dataset<Row> emptyConceptMaps = conceptMapConverter.emptyDataFrame(spark) .withColumn("timestamp", lit(null).cast("timestamp")); return new ConceptMaps(spark, spark.emptyDataset(URL_AND_VERSION_EN... | ConceptMaps extends AbstractConceptMaps<ConceptMap, ConceptMaps> { public static ConceptMaps getEmpty(SparkSession spark) { Dataset<Row> emptyConceptMaps = conceptMapConverter.emptyDataFrame(spark) .withColumn("timestamp", lit(null).cast("timestamp")); return new ConceptMaps(spark, spark.emptyDataset(URL_AND_VERSION_EN... | ConceptMaps extends AbstractConceptMaps<ConceptMap, ConceptMaps> { public static ConceptMaps getEmpty(SparkSession spark) { Dataset<Row> emptyConceptMaps = conceptMapConverter.emptyDataFrame(spark) .withColumn("timestamp", lit(null).cast("timestamp")); return new ConceptMaps(spark, spark.emptyDataset(URL_AND_VERSION_EN... |
@Test void throwsExceptionWhenExecuteInfoIsNotFound() { assertThatExceptionOfType(StarCraft2ControllerException.class) .isThrownBy(() -> starcraft2Game().getGameConfiguration()) .withMessage("Invalid argument was provided") .withCause(new IllegalArgumentException("ExecuteInfo.txt is required")); } | public static Builder starcraft2Game() { return new Builder(); } | S2Controller extends DefaultSubscriber<Response> { public static Builder starcraft2Game() { return new Builder(); } } | S2Controller extends DefaultSubscriber<Response> { public static Builder starcraft2Game() { return new Builder(); } private S2Controller(Config config); } | S2Controller extends DefaultSubscriber<Response> { public static Builder starcraft2Game() { return new Builder(); } private S2Controller(Config config); static Builder starcraft2Game(); S2Controller untilReady(); void stop(); boolean stopAndWait(); boolean stopAndWait(long timeoutInMillis); void isInState(GameStatus e... | S2Controller extends DefaultSubscriber<Response> { public static Builder starcraft2Game() { return new Builder(); } private S2Controller(Config config); static Builder starcraft2Game(); S2Controller untilReady(); void stop(); boolean stopAndWait(); boolean stopAndWait(long timeoutInMillis); void isInState(GameStatus e... |
@Test void throwsExceptionWhenPlayerRelativeIsNotProvided() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> FeatureLayersMinimap.from(without( () -> sc2ApiFeatureLayersMinimap().toBuilder(), Spatial.FeatureLayersMinimap.Builder::clearPlayerRelative).build())) .withMessage("player relative ... | public static FeatureLayersMinimap from(Spatial.FeatureLayersMinimap sc2ApiFeatureLayersMinimap) { require("sc2api feature layers minimap", sc2ApiFeatureLayersMinimap); return new FeatureLayersMinimap(sc2ApiFeatureLayersMinimap); } | FeatureLayersMinimap implements Serializable { public static FeatureLayersMinimap from(Spatial.FeatureLayersMinimap sc2ApiFeatureLayersMinimap) { require("sc2api feature layers minimap", sc2ApiFeatureLayersMinimap); return new FeatureLayersMinimap(sc2ApiFeatureLayersMinimap); } } | FeatureLayersMinimap implements Serializable { public static FeatureLayersMinimap from(Spatial.FeatureLayersMinimap sc2ApiFeatureLayersMinimap) { require("sc2api feature layers minimap", sc2ApiFeatureLayersMinimap); return new FeatureLayersMinimap(sc2ApiFeatureLayersMinimap); } private FeatureLayersMinimap(Spatial.Fea... | FeatureLayersMinimap implements Serializable { public static FeatureLayersMinimap from(Spatial.FeatureLayersMinimap sc2ApiFeatureLayersMinimap) { require("sc2api feature layers minimap", sc2ApiFeatureLayersMinimap); return new FeatureLayersMinimap(sc2ApiFeatureLayersMinimap); } private FeatureLayersMinimap(Spatial.Fea... | FeatureLayersMinimap implements Serializable { public static FeatureLayersMinimap from(Spatial.FeatureLayersMinimap sc2ApiFeatureLayersMinimap) { require("sc2api feature layers minimap", sc2ApiFeatureLayersMinimap); return new FeatureLayersMinimap(sc2ApiFeatureLayersMinimap); } private FeatureLayersMinimap(Spatial.Fea... |
@Test void throwsExceptionWhenSc2ApiImageDataIsNull() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> ImageData.from(nothing())) .withMessage("sc2api image data is required"); } | public static ImageData from(Common.ImageData sc2ApiImageData) { require("sc2api image data", sc2ApiImageData); return new ImageData(sc2ApiImageData); } | ImageData implements Serializable { public static ImageData from(Common.ImageData sc2ApiImageData) { require("sc2api image data", sc2ApiImageData); return new ImageData(sc2ApiImageData); } } | ImageData implements Serializable { public static ImageData from(Common.ImageData sc2ApiImageData) { require("sc2api image data", sc2ApiImageData); return new ImageData(sc2ApiImageData); } private ImageData(Common.ImageData sc2ApiImageData); } | ImageData implements Serializable { public static ImageData from(Common.ImageData sc2ApiImageData) { require("sc2api image data", sc2ApiImageData); return new ImageData(sc2ApiImageData); } private ImageData(Common.ImageData sc2ApiImageData); static ImageData from(Common.ImageData sc2ApiImageData); int getBitsPerPixel(... | ImageData implements Serializable { public static ImageData from(Common.ImageData sc2ApiImageData) { require("sc2api image data", sc2ApiImageData); return new ImageData(sc2ApiImageData); } private ImageData(Common.ImageData sc2ApiImageData); static ImageData from(Common.ImageData sc2ApiImageData); int getBitsPerPixel(... |
@Test void convertsAllFieldsFromSc2ApiImageData() { assertThatAllFieldsAreConverted(ImageData.from(sc2ApiImageData())); } | public static ImageData from(Common.ImageData sc2ApiImageData) { require("sc2api image data", sc2ApiImageData); return new ImageData(sc2ApiImageData); } | ImageData implements Serializable { public static ImageData from(Common.ImageData sc2ApiImageData) { require("sc2api image data", sc2ApiImageData); return new ImageData(sc2ApiImageData); } } | ImageData implements Serializable { public static ImageData from(Common.ImageData sc2ApiImageData) { require("sc2api image data", sc2ApiImageData); return new ImageData(sc2ApiImageData); } private ImageData(Common.ImageData sc2ApiImageData); } | ImageData implements Serializable { public static ImageData from(Common.ImageData sc2ApiImageData) { require("sc2api image data", sc2ApiImageData); return new ImageData(sc2ApiImageData); } private ImageData(Common.ImageData sc2ApiImageData); static ImageData from(Common.ImageData sc2ApiImageData); int getBitsPerPixel(... | ImageData implements Serializable { public static ImageData from(Common.ImageData sc2ApiImageData) { require("sc2api image data", sc2ApiImageData); return new ImageData(sc2ApiImageData); } private ImageData(Common.ImageData sc2ApiImageData); static ImageData from(Common.ImageData sc2ApiImageData); int getBitsPerPixel(... |
@Test void throwsExceptionWhenBitsPerPixelIsNotProvided() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> ImageData.from(without( () -> sc2ApiImageData().toBuilder(), Common.ImageData.Builder::clearBitsPerPixel).build())) .withMessage("bits per pixel is required"); } | public static ImageData from(Common.ImageData sc2ApiImageData) { require("sc2api image data", sc2ApiImageData); return new ImageData(sc2ApiImageData); } | ImageData implements Serializable { public static ImageData from(Common.ImageData sc2ApiImageData) { require("sc2api image data", sc2ApiImageData); return new ImageData(sc2ApiImageData); } } | ImageData implements Serializable { public static ImageData from(Common.ImageData sc2ApiImageData) { require("sc2api image data", sc2ApiImageData); return new ImageData(sc2ApiImageData); } private ImageData(Common.ImageData sc2ApiImageData); } | ImageData implements Serializable { public static ImageData from(Common.ImageData sc2ApiImageData) { require("sc2api image data", sc2ApiImageData); return new ImageData(sc2ApiImageData); } private ImageData(Common.ImageData sc2ApiImageData); static ImageData from(Common.ImageData sc2ApiImageData); int getBitsPerPixel(... | ImageData implements Serializable { public static ImageData from(Common.ImageData sc2ApiImageData) { require("sc2api image data", sc2ApiImageData); return new ImageData(sc2ApiImageData); } private ImageData(Common.ImageData sc2ApiImageData); static ImageData from(Common.ImageData sc2ApiImageData); int getBitsPerPixel(... |
@Test void throwsExceptionWhenSizeIsNotProvided() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> ImageData.from(without( () -> sc2ApiImageData().toBuilder(), Common.ImageData.Builder::clearSize).build())) .withMessage("size is required"); } | public static ImageData from(Common.ImageData sc2ApiImageData) { require("sc2api image data", sc2ApiImageData); return new ImageData(sc2ApiImageData); } | ImageData implements Serializable { public static ImageData from(Common.ImageData sc2ApiImageData) { require("sc2api image data", sc2ApiImageData); return new ImageData(sc2ApiImageData); } } | ImageData implements Serializable { public static ImageData from(Common.ImageData sc2ApiImageData) { require("sc2api image data", sc2ApiImageData); return new ImageData(sc2ApiImageData); } private ImageData(Common.ImageData sc2ApiImageData); } | ImageData implements Serializable { public static ImageData from(Common.ImageData sc2ApiImageData) { require("sc2api image data", sc2ApiImageData); return new ImageData(sc2ApiImageData); } private ImageData(Common.ImageData sc2ApiImageData); static ImageData from(Common.ImageData sc2ApiImageData); int getBitsPerPixel(... | ImageData implements Serializable { public static ImageData from(Common.ImageData sc2ApiImageData) { require("sc2api image data", sc2ApiImageData); return new ImageData(sc2ApiImageData); } private ImageData(Common.ImageData sc2ApiImageData); static ImageData from(Common.ImageData sc2ApiImageData); int getBitsPerPixel(... |
@Test void throwsExceptionWhenImageIsNotProvided() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> ImageData.from(without( () -> sc2ApiImageData().toBuilder(), Common.ImageData.Builder::clearData).build())) .withMessage("data is required"); } | public static ImageData from(Common.ImageData sc2ApiImageData) { require("sc2api image data", sc2ApiImageData); return new ImageData(sc2ApiImageData); } | ImageData implements Serializable { public static ImageData from(Common.ImageData sc2ApiImageData) { require("sc2api image data", sc2ApiImageData); return new ImageData(sc2ApiImageData); } } | ImageData implements Serializable { public static ImageData from(Common.ImageData sc2ApiImageData) { require("sc2api image data", sc2ApiImageData); return new ImageData(sc2ApiImageData); } private ImageData(Common.ImageData sc2ApiImageData); } | ImageData implements Serializable { public static ImageData from(Common.ImageData sc2ApiImageData) { require("sc2api image data", sc2ApiImageData); return new ImageData(sc2ApiImageData); } private ImageData(Common.ImageData sc2ApiImageData); static ImageData from(Common.ImageData sc2ApiImageData); int getBitsPerPixel(... | ImageData implements Serializable { public static ImageData from(Common.ImageData sc2ApiImageData) { require("sc2api image data", sc2ApiImageData); return new ImageData(sc2ApiImageData); } private ImageData(Common.ImageData sc2ApiImageData); static ImageData from(Common.ImageData sc2ApiImageData); int getBitsPerPixel(... |
@Test void throwsExceptionWhenImageSizeIsInvalid() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> ImageData.from(corruptedSc2ApiImageData())) .withMessage("expected image size [4096] is not equal actual size [1]"); } | public static ImageData from(Common.ImageData sc2ApiImageData) { require("sc2api image data", sc2ApiImageData); return new ImageData(sc2ApiImageData); } | ImageData implements Serializable { public static ImageData from(Common.ImageData sc2ApiImageData) { require("sc2api image data", sc2ApiImageData); return new ImageData(sc2ApiImageData); } } | ImageData implements Serializable { public static ImageData from(Common.ImageData sc2ApiImageData) { require("sc2api image data", sc2ApiImageData); return new ImageData(sc2ApiImageData); } private ImageData(Common.ImageData sc2ApiImageData); } | ImageData implements Serializable { public static ImageData from(Common.ImageData sc2ApiImageData) { require("sc2api image data", sc2ApiImageData); return new ImageData(sc2ApiImageData); } private ImageData(Common.ImageData sc2ApiImageData); static ImageData from(Common.ImageData sc2ApiImageData); int getBitsPerPixel(... | ImageData implements Serializable { public static ImageData from(Common.ImageData sc2ApiImageData) { require("sc2api image data", sc2ApiImageData); return new ImageData(sc2ApiImageData); } private ImageData(Common.ImageData sc2ApiImageData); static ImageData from(Common.ImageData sc2ApiImageData); int getBitsPerPixel(... |
@Test void throwsExceptionWhenImageTypeIsUnsupported() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> ImageData.from(sc2ApiImageDataWithTwoBitPerPixel())) .withMessage("Unsupported image type with bits per pixel [2]. Expected {1, 8, 24, 32}."); } | public static ImageData from(Common.ImageData sc2ApiImageData) { require("sc2api image data", sc2ApiImageData); return new ImageData(sc2ApiImageData); } | ImageData implements Serializable { public static ImageData from(Common.ImageData sc2ApiImageData) { require("sc2api image data", sc2ApiImageData); return new ImageData(sc2ApiImageData); } } | ImageData implements Serializable { public static ImageData from(Common.ImageData sc2ApiImageData) { require("sc2api image data", sc2ApiImageData); return new ImageData(sc2ApiImageData); } private ImageData(Common.ImageData sc2ApiImageData); } | ImageData implements Serializable { public static ImageData from(Common.ImageData sc2ApiImageData) { require("sc2api image data", sc2ApiImageData); return new ImageData(sc2ApiImageData); } private ImageData(Common.ImageData sc2ApiImageData); static ImageData from(Common.ImageData sc2ApiImageData); int getBitsPerPixel(... | ImageData implements Serializable { public static ImageData from(Common.ImageData sc2ApiImageData) { require("sc2api image data", sc2ApiImageData); return new ImageData(sc2ApiImageData); } private ImageData(Common.ImageData sc2ApiImageData); static ImageData from(Common.ImageData sc2ApiImageData); int getBitsPerPixel(... |
@Test void throwsExceptionWhenSc2ApiObservationFeatureLayerIsNull() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> ObservationFeatureLayer.from(nothing())) .withMessage("sc2api observation feature layer is required"); } | public static ObservationFeatureLayer from(Spatial.ObservationFeatureLayer sc2ApiObservationFeatureLayer) { require("sc2api observation feature layer", sc2ApiObservationFeatureLayer); return new ObservationFeatureLayer(sc2ApiObservationFeatureLayer); } | ObservationFeatureLayer implements Serializable { public static ObservationFeatureLayer from(Spatial.ObservationFeatureLayer sc2ApiObservationFeatureLayer) { require("sc2api observation feature layer", sc2ApiObservationFeatureLayer); return new ObservationFeatureLayer(sc2ApiObservationFeatureLayer); } } | ObservationFeatureLayer implements Serializable { public static ObservationFeatureLayer from(Spatial.ObservationFeatureLayer sc2ApiObservationFeatureLayer) { require("sc2api observation feature layer", sc2ApiObservationFeatureLayer); return new ObservationFeatureLayer(sc2ApiObservationFeatureLayer); } private Observat... | ObservationFeatureLayer implements Serializable { public static ObservationFeatureLayer from(Spatial.ObservationFeatureLayer sc2ApiObservationFeatureLayer) { require("sc2api observation feature layer", sc2ApiObservationFeatureLayer); return new ObservationFeatureLayer(sc2ApiObservationFeatureLayer); } private Observat... | ObservationFeatureLayer implements Serializable { public static ObservationFeatureLayer from(Spatial.ObservationFeatureLayer sc2ApiObservationFeatureLayer) { require("sc2api observation feature layer", sc2ApiObservationFeatureLayer); return new ObservationFeatureLayer(sc2ApiObservationFeatureLayer); } private Observat... |
@Test void convertsAllFieldsFromSc2ApiObservationFeatureLayer() { assertThatAllFieldsAreConverted(ObservationFeatureLayer.from(sc2ApiObservationFeatureLayer())); } | public static ObservationFeatureLayer from(Spatial.ObservationFeatureLayer sc2ApiObservationFeatureLayer) { require("sc2api observation feature layer", sc2ApiObservationFeatureLayer); return new ObservationFeatureLayer(sc2ApiObservationFeatureLayer); } | ObservationFeatureLayer implements Serializable { public static ObservationFeatureLayer from(Spatial.ObservationFeatureLayer sc2ApiObservationFeatureLayer) { require("sc2api observation feature layer", sc2ApiObservationFeatureLayer); return new ObservationFeatureLayer(sc2ApiObservationFeatureLayer); } } | ObservationFeatureLayer implements Serializable { public static ObservationFeatureLayer from(Spatial.ObservationFeatureLayer sc2ApiObservationFeatureLayer) { require("sc2api observation feature layer", sc2ApiObservationFeatureLayer); return new ObservationFeatureLayer(sc2ApiObservationFeatureLayer); } private Observat... | ObservationFeatureLayer implements Serializable { public static ObservationFeatureLayer from(Spatial.ObservationFeatureLayer sc2ApiObservationFeatureLayer) { require("sc2api observation feature layer", sc2ApiObservationFeatureLayer); return new ObservationFeatureLayer(sc2ApiObservationFeatureLayer); } private Observat... | ObservationFeatureLayer implements Serializable { public static ObservationFeatureLayer from(Spatial.ObservationFeatureLayer sc2ApiObservationFeatureLayer) { require("sc2api observation feature layer", sc2ApiObservationFeatureLayer); return new ObservationFeatureLayer(sc2ApiObservationFeatureLayer); } private Observat... |
@Test void throwsExceptionWhenFriendlyNameIsNotProvided() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> EffectData.from(without( () -> sc2ApiEffectData().toBuilder(), Data.EffectData.Builder::clearFriendlyName).build())) .withMessage("friendly name is required"); } | public static EffectData from(Data.EffectData sc2ApiEffectData) { require("sc2api effect data", sc2ApiEffectData); return new EffectData(sc2ApiEffectData); } | EffectData implements Serializable { public static EffectData from(Data.EffectData sc2ApiEffectData) { require("sc2api effect data", sc2ApiEffectData); return new EffectData(sc2ApiEffectData); } } | EffectData implements Serializable { public static EffectData from(Data.EffectData sc2ApiEffectData) { require("sc2api effect data", sc2ApiEffectData); return new EffectData(sc2ApiEffectData); } private EffectData(Data.EffectData sc2ApiEffectData); } | EffectData implements Serializable { public static EffectData from(Data.EffectData sc2ApiEffectData) { require("sc2api effect data", sc2ApiEffectData); return new EffectData(sc2ApiEffectData); } private EffectData(Data.EffectData sc2ApiEffectData); static EffectData from(Data.EffectData sc2ApiEffectData); Effect getEf... | EffectData implements Serializable { public static EffectData from(Data.EffectData sc2ApiEffectData) { require("sc2api effect data", sc2ApiEffectData); return new EffectData(sc2ApiEffectData); } private EffectData(Data.EffectData sc2ApiEffectData); static EffectData from(Data.EffectData sc2ApiEffectData); Effect getEf... |
@Test void throwsExceptionWhenRendersIsNotProvided() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> ObservationFeatureLayer.from(without( () -> sc2ApiObservationFeatureLayer().toBuilder(), Spatial.ObservationFeatureLayer.Builder::clearRenders).build())) .withMessage("renders is required")... | public static ObservationFeatureLayer from(Spatial.ObservationFeatureLayer sc2ApiObservationFeatureLayer) { require("sc2api observation feature layer", sc2ApiObservationFeatureLayer); return new ObservationFeatureLayer(sc2ApiObservationFeatureLayer); } | ObservationFeatureLayer implements Serializable { public static ObservationFeatureLayer from(Spatial.ObservationFeatureLayer sc2ApiObservationFeatureLayer) { require("sc2api observation feature layer", sc2ApiObservationFeatureLayer); return new ObservationFeatureLayer(sc2ApiObservationFeatureLayer); } } | ObservationFeatureLayer implements Serializable { public static ObservationFeatureLayer from(Spatial.ObservationFeatureLayer sc2ApiObservationFeatureLayer) { require("sc2api observation feature layer", sc2ApiObservationFeatureLayer); return new ObservationFeatureLayer(sc2ApiObservationFeatureLayer); } private Observat... | ObservationFeatureLayer implements Serializable { public static ObservationFeatureLayer from(Spatial.ObservationFeatureLayer sc2ApiObservationFeatureLayer) { require("sc2api observation feature layer", sc2ApiObservationFeatureLayer); return new ObservationFeatureLayer(sc2ApiObservationFeatureLayer); } private Observat... | ObservationFeatureLayer implements Serializable { public static ObservationFeatureLayer from(Spatial.ObservationFeatureLayer sc2ApiObservationFeatureLayer) { require("sc2api observation feature layer", sc2ApiObservationFeatureLayer); return new ObservationFeatureLayer(sc2ApiObservationFeatureLayer); } private Observat... |
@Test void throwsExceptionWhenMinimapRendersIsNotProvided() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> ObservationFeatureLayer.from(without( () -> sc2ApiObservationFeatureLayer().toBuilder(), Spatial.ObservationFeatureLayer.Builder::clearMinimapRenders).build())) .withMessage("minimap... | public static ObservationFeatureLayer from(Spatial.ObservationFeatureLayer sc2ApiObservationFeatureLayer) { require("sc2api observation feature layer", sc2ApiObservationFeatureLayer); return new ObservationFeatureLayer(sc2ApiObservationFeatureLayer); } | ObservationFeatureLayer implements Serializable { public static ObservationFeatureLayer from(Spatial.ObservationFeatureLayer sc2ApiObservationFeatureLayer) { require("sc2api observation feature layer", sc2ApiObservationFeatureLayer); return new ObservationFeatureLayer(sc2ApiObservationFeatureLayer); } } | ObservationFeatureLayer implements Serializable { public static ObservationFeatureLayer from(Spatial.ObservationFeatureLayer sc2ApiObservationFeatureLayer) { require("sc2api observation feature layer", sc2ApiObservationFeatureLayer); return new ObservationFeatureLayer(sc2ApiObservationFeatureLayer); } private Observat... | ObservationFeatureLayer implements Serializable { public static ObservationFeatureLayer from(Spatial.ObservationFeatureLayer sc2ApiObservationFeatureLayer) { require("sc2api observation feature layer", sc2ApiObservationFeatureLayer); return new ObservationFeatureLayer(sc2ApiObservationFeatureLayer); } private Observat... | ObservationFeatureLayer implements Serializable { public static ObservationFeatureLayer from(Spatial.ObservationFeatureLayer sc2ApiObservationFeatureLayer) { require("sc2api observation feature layer", sc2ApiObservationFeatureLayer); return new ObservationFeatureLayer(sc2ApiObservationFeatureLayer); } private Observat... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.