public DirectedGraph( org.jgrapht.Graph<FlowElement, Scope> parent ) { this(); Graphs.addGraph( this, parent ); }
protected FlowElementGraph shallowCopyElementGraph() { FlowElementGraph copy = new FlowElementGraph(); Graphs.addGraph( copy.graph, this.graph ); copy.traps = new HashMap<String, Tap>( this.traps ); return copy; }
/** * Adds all the vertices and all the edges of the {@code sourceGraph} to the graph being built. * * @param sourceGraph the source graph * @return this builder object * * @see Graphs#addGraph(Graph, Graph) */ public B addGraph(Graph<? extends V, ? extends E> sourceGraph) { Graphs.addGraph(this.graph, sourceGraph); return this.self(); }
.getIntrusiveEdgesSpecificsFactory().apply(newGraph.type); Graphs.addGraph(newGraph, this);
this.originalGraph.getVertexSupplier(), this.originalGraph.getEdgeSupplier()), new HashMap<>(), false); Graphs.addGraph(workingGraph, this.originalGraph);
Graphs.addGraph(eulerGraph, graph); Map<E, GraphPath<V, E>> shortcutEdges = new HashMap<>(); for (DefaultWeightedEdge e : matching.getEdges()) {
Graphs.addGraph(eulerGraph, graph); Map<E, GraphPath<V, E>> shortcutEdges = new HashMap<>(); for (DefaultWeightedEdge e : matching.getEdges()) {
Graphs.addGraph(result, subSubgraph);
Graphs.addGraph(result, subComponentGraph); if (noOutgoing != null && noIncoming != null && !noOutgoing.equals(noIncoming)) { result.addDagEdge(noOutgoing, noIncoming);
private void assertGraphs( SimpleDirectedGraph<String, Object> full, SimpleDirectedGraph<String, Object> contracted, SimpleDirectedGraph<String, Object> result ) { // Set<String> vertices = ElementGraphs.findClosureViaBiConnected( full, contracted ); Set<String> vertices = ElementGraphs.findClosureViaFloydWarshall( full, contracted ).getLhs(); // Set<String> vertices = ElementGraphs.findClosureViaKShortest( full, contracted ); DirectedSubgraph<String, Object> subgraph = new DirectedSubgraph<>( full, vertices, null ); // System.out.println( "subgraph = " + subgraph ); SimpleDirectedGraph<String, Object> clone = new SimpleDirectedGraph<>( Object.class ); Graphs.addGraph( clone, subgraph ); assertEquals( result, clone ); }
/** * Create a copy of a graph for internal use. * * @param graph the graph to copy. * * @return A copy of the graph projected to a SimpleGraph. */ private static <V, E> Graph<V, E> copyAsSimpleGraph(Graph<V, E> graph) { Graph<V, E> copy = GraphTypeBuilder .<V, E> undirected().edgeSupplier(graph.getEdgeSupplier()) .vertexSupplier(graph.getVertexSupplier()).allowingMultipleEdges(false) .allowingSelfLoops(false).buildGraph(); if (graph.getType().isSimple()) { Graphs.addGraph(copy, graph); } else { // project graph to SimpleGraph Graphs.addAllVertices(copy, graph.vertexSet()); for (E e : graph.edgeSet()) { V v1 = graph.getEdgeSource(e); V v2 = graph.getEdgeTarget(e); if (!v1.equals(v2) && !copy.containsEdge(e)) { copy.addEdge(v1, v2); } } } return copy; }