/** * For the iterative algorithm to work properly the refinement and * optimization options should be turned on, because the alignment has to be * consistent at every recursive step. * * @param param * CeSymm parameters, make sure they are cloned */ public CeSymmIterative(CESymmParameters param) { params = param; alignGraph = new SimpleGraph<Integer, DefaultEdge>(DefaultEdge.class); levels = new ArrayList<CeSymmResult>(); }
SimpleGraph<Section, Touching> graph = new SimpleGraph<>(Touching.class); graph.addVertex(section); graph.addEdge(one, two, new Touching());
Set<GlyphLink> glyphEdges = graph.edgesOf(glyph); SimpleGraph<Glyph, GlyphLink> subGraph = new SimpleGraph<>(GlyphLink.class); Graphs.addAllVertices(subGraph, set); Graphs.addAllEdges(subGraph, graph, setEdges);
final SimpleGraph< Spot, DefaultWeightedEdge > graph = new SimpleGraph< >( DefaultWeightedEdge.class ); graph.addVertex( spot ); graph.addEdge( tm.getEdgeSource( edge ), tm.getEdgeTarget( edge ) ); graph.removeEdge( spot, successor ); links.add( makeLink( spot, successor ) ); graph.removeEdge( predecessor, spot ); links.add( makeLink( predecessor, spot ) ); graph.removeEdge( spot, successor ); links.add( makeLink( spot, successor ) ); graph.removeEdge( previous, spot ); links.add( makeLink( previous, spot ) ); boolean found = false; graph.removeEdge( spot, successor ); links.add( makeLink( spot, successor ) ); graph.removeEdge( predecessor, spot ); links.add( makeLink( predecessor, spot ) ); graph.removeEdge( spot, next ); links.add( makeLink( spot, next ) ); boolean found = false;
final SimpleGraph< Spot, DefaultWeightedEdge > graph = new SimpleGraph< >( DefaultWeightedEdge.class ); graph.addVertex( spot ); graph.addEdge( tm.getEdgeSource( edge ), tm.getEdgeTarget( edge ) ); graph.removeEdge( spot, successor ); links.add( makeLink( spot, successor ) ); graph.removeEdge( predecessor, spot ); links.add( makeLink( predecessor, spot ) ); graph.removeEdge( spot, successor ); links.add( makeLink( spot, successor ) ); graph.removeEdge( previous, spot ); links.add( makeLink( previous, spot ) ); boolean found = false; graph.removeEdge( spot, successor ); links.add( makeLink( spot, successor ) ); graph.removeEdge( predecessor, spot ); links.add( makeLink( predecessor, spot ) ); graph.removeEdge( spot, next ); links.add( makeLink( spot, next ) ); boolean found = false;
/** * Create a builder for this kind of graph. * * @param edgeClass class on which to base factory for edges * @param <V> the graph vertex type * @param <E> the graph edge type * @return a builder for this kind of graph */ public static <V, E> GraphBuilder<V, E, ? extends SimpleGraph<V, E>> createBuilder( Class<? extends E> edgeClass) { return new GraphBuilder<>(new SimpleGraph<>(edgeClass)); }
SimpleGraph<Glyph, GlyphLink> graph = new SimpleGraph<>(GlyphLink.class); graph.addVertex(glyph); graph.addEdge(glyph, other, new GlyphLink.Nearby(dist));
/** * Create a builder for this kind of graph. * * @param edgeSupplier the edge supplier of the new graph * @param <V> the graph vertex type * @param <E> the graph edge type * @return a builder for this kind of graph */ public static <V, E> GraphBuilder<V, E, ? extends SimpleGraph<V, E>> createBuilder(Supplier<E> edgeSupplier) { return new GraphBuilder<>(new SimpleGraph<>(null, edgeSupplier, false)); }
public static Graph<Node, LabeledEdge<Node, Node>> toGraph(QuadFilterPatternCanonical qfpc) { //EdgeFactory <Node, LabeledEdge<Node, Node>> edgeFactory = (v, e) -> new LabeledEdgeImpl<>(v, e, null); Graph<Node, LabeledEdge<Node, Node>> graph = new SimpleGraph<>((v, e) -> new LabeledEdgeImpl<>(v, e, null)); toGraph(graph, qfpc); return graph; } public static Stream<Map<Var, Var>> match(QuadFilterPatternCanonical view, QuadFilterPatternCanonical user) {
private static Graph<Integer, DefaultEdge> initContactGraph(List<SubunitCluster> clusters){ Graph<Integer, DefaultEdge> graph = new SimpleGraph<>(DefaultEdge.class);
public IndexFilteredTriplePattern() { this.graph = new SimpleGraph<>((v, e) -> new LabeledEdgeImpl<>(v, e, null)); this.keyToNode = new ReversibleMapImpl<>(); }
/** * Convenience method for testing. * Only works for queries whose element is a BGP + filters. * * @param view * @param user * @return */ public static boolean tryMatch(Query view, Query user) { Graph<Node, LabeledEdge<Node, Node>> a = new SimpleGraph<>((v, e) -> new LabeledEdgeImpl<>(v, e, null)); Graph<Node, LabeledEdge<Node, Node>> b = new SimpleGraph<>((v, e) -> new LabeledEdgeImpl<>(v, e, null)); toGraph(a, view); toGraph(b, user); // visualizeGraph(a); // visualizeGraph(b); // try(Scanner s = new Scanner(System.in)) { s.nextLine(); } Stream<Map<Var, Var>> tmp = QueryToGraph.match(a, b); tmp = tmp.peek(x -> System.out.println("Solution: " + x)); boolean result = tmp.count() > 0; return result; }
public static void main(String [] args) completeGraph = new SimpleGraph<Object, DefaultEdge>(DefaultEdge.class);
/** * Compute the Voronoi diagram as a graph of its vertices * * @param points * the vertices * @param width * the width of the diagram * @param height * the height of the diagram * @return the graph */ public static Graph<Point2d, DefaultEdge> computeVoronoiGraph(List<? extends Point2d> points, double width, double height) { final FortunesAlgorithm f = new FortunesAlgorithm(width, height); final List<Line2d> edges = f.runFortune(points); final Graph<Point2d, DefaultEdge> graph = new SimpleGraph<Point2d, DefaultEdge>(DefaultEdge.class); for (final Line2d l : edges) { graph.addEdge(l.begin, l.end); } return graph; }
private List<Set<String>> getClusters(List<String> dir1, List<String> dir2, Matrix scores) { UndirectedGraph<String, DefaultEdge> graph = new SimpleGraph<String, DefaultEdge>(DefaultEdge.class); for (String f : dir1) graph.addVertex(f); if (dir1 != dir2) for (String f : dir2) graph.addVertex(f); final double[][] matrixData = scores.getArray(); for (int r=0; r<matrixData.length; r++) { for (int c=r; c<matrixData[0].length; c++) { String f1 = dir1.get(r); String f2 = dir2.get(c); if ( matrixData[r][c] != 0 && f1!=f2 ) { graph.addEdge(f1, f2); } } } ConnectivityInspector<String, DefaultEdge> conn = new ConnectivityInspector<String, DefaultEdge>(graph); return conn.connectedSets(); }
private List<Set<String>> getClusters(List<String> dir1, List<String> dir2, Matrix scores) { UndirectedGraph<String, DefaultEdge> graph = new SimpleGraph<String, DefaultEdge>(DefaultEdge.class); for (String f : dir1) graph.addVertex(f); if (dir1 != dir2) for (String f : dir2) graph.addVertex(f); final double[][] matrixData = scores.getArray(); for (int r=0; r<matrixData.length; r++) { for (int c=r; c<matrixData[0].length; c++) { String f1 = dir1.get(r); String f2 = dir2.get(c); if ( matrixData[r][c] != 0 && f1!=f2 ) { graph.addEdge(f1, f2); } } } ConnectivityInspector<String, DefaultEdge> conn = new ConnectivityInspector<String, DefaultEdge>(graph); return conn.connectedSets(); }
public static boolean bipartiteMatchingFull(SparseDoubleMatrix2D candidateList, int[] signatureDepths, int[] functionDepths, int depth) { UndirectedGraph<String, DefaultEdge> g = new SimpleGraph<String, DefaultEdge>(DefaultEdge.class);
public static boolean bipartiteMatchingDepth(SparseDoubleMatrix2D candidateList, int[] signatureDepths, int[] functionDepths, int depth) { UndirectedGraph<String, DefaultEdge> g = new SimpleGraph<String, DefaultEdge>(DefaultEdge.class); List<String> signatureIdcs = new ArrayList<String>(); int signatureNodesAtDepth = 0;
Graph<V, DefaultEdge> mst = new SimpleGraph<>(DefaultEdge.class); for (V v : graph.vertexSet()) { mst.addVertex(v);
boolean reverse) { Graph<Node, DefaultEdge> augJoinGraph = new SimpleGraph<>(DefaultEdge.class);