@Override public int getIncidentCount(E edge) { if (!delegate.containsEdge(edge)) return 0; // all edges in a tree connect exactly 2 vertices return 2; }
/** * @see edu.uci.ics.jung.graph.Hypergraph#containsEdge(java.lang.Object) */ public synchronized boolean containsEdge(E edge) { return delegate.containsEdge(edge); }
/** * @see edu.uci.ics.jung.graph.Hypergraph#containsEdge(java.lang.Object) */ public boolean containsEdge(E edge) { return delegate.containsEdge(edge); }
/** * @see edu.uci.ics.jung.graph.Hypergraph#containsEdge(java.lang.Object) */ @Override public boolean containsEdge(E edge) { return delegate.containsEdge(edge); }
@Override public int getIncidentCount(E edge) { if (!delegate.containsEdge(edge)) { return 0; } // all edges in a tree connect exactly 2 vertices return 2; }
/** * @see edu.uci.ics.jung.graph.Hypergraph#containsEdge(java.lang.Object) */ @Override public boolean containsEdge(E edge) { return delegate.containsEdge(edge); }
/** * @see edu.uci.ics.jung.graph.Hypergraph#containsEdge(java.lang.Object) */ @Override public synchronized boolean containsEdge(E edge) { return delegate.containsEdge(edge); }
/** * @see edu.uci.ics.jung.graph.Hypergraph#containsEdge(java.lang.Object) */ public boolean containsEdge(E edge) { return delegate.containsEdge(edge); }
/** * Returns <code>true</code> if the graph contains the edge. * @param edge The edge. * @return <code>true</code> if the edge is in the graph. */ public boolean containsEdge(Object edge) { return delegate.containsEdge(edge); } /**
public boolean containsEdge(E edge) { return graph.containsEdge(edge); } public boolean containsVertex(V vertex) {
public boolean FindEdgeByIDCurrentGraph(String name) { if (name != null && !name.isEmpty()) { if (currentGraph != null) return currentGraph.containsEdge(name); else return false; } else { return false; } }
public boolean FindEdgeByIDEntireGraph(String name) { if (name != null && !name.isEmpty()) { if (entireGraph != null) return entireGraph.containsEdge(name); else return false; } else { return false; } }
@Override public Double transform(Link edge) { if (graph.containsEdge(edge)) { if (edge.getId() < 0) throw new RuntimeException("Bad"); return nev.transform(edge); } else if (auxGraph.containsEdge(edge)) { return 1.0; } throw new RuntimeException("Bad"); } };
continue; if (dGraph.containsEdge(edge)) {
/** * Removes <code>edge</code> from this tree. If <code>remove_subtree</code> * is <code>true</code>, removes the subtree rooted at the child vertex * incident to <code>edge</code>. Otherwise, leaves the subtree intact as a * new component tree of this forest. * * @param edge * the edge to remove * @param remove_subtree * if <code>true</code>, remove the subtree * @return <code>true</code> iff the tree was modified */ public boolean removeEdge(E edge, boolean remove_subtree) { if (!delegate.containsEdge(edge)) { return false; } V child = getDest(edge); if (remove_subtree) { return removeVertex(child); } delegate.removeEdge(edge); return false; }
/** Returns the shortest pair of node-disjoint paths, where each item represents a path. The number of returned items will be equal to the number of paths found: when empty, no path was found; when {@code size()} = 1, only one path was found; and when {@code size()} = 2, the node-disjoint paths were found. Internally it uses the Suurballe-Tarjan algorithm. * * @param graph Graph representing the network * @param nev Object responsible for returning weights for edges * @param originNode Origin node * @param destinationNode Origin node * @return Shortest pair of node-disjoint paths */ public static List<List<Link>> getTwoNodeDisjointPaths(final Graph<Node, Link> graph, final Transformer<Link, Double> nev, Node originNode, Node destinationNode) { List<List<Link>> nodeDisjointSPs = new LinkedList<List<Link>>(); if (graph.getVertexCount() < 2 || !graph.containsVertex(originNode) || !graph.containsVertex(destinationNode)) return nodeDisjointSPs; Pair<Graph<Node, Link>, Transformer<Link, Double>> aux = buildAuxiliaryNodeDisjointGraph(graph, nev, originNode, destinationNode); Graph<Node, Link> auxGraph = aux.getFirst(); Transformer<Link, Double> auxNev = aux.getSecond(); nodeDisjointSPs = getTwoLinkDisjointPaths(auxGraph, auxNev, originNode, destinationNode); for (List<Link> auxSP : nodeDisjointSPs) { Iterator<Link> it = auxSP.iterator(); while (it.hasNext()) { Link edge = it.next(); if (!graph.containsEdge(edge)) it.remove(); } } return nodeDisjointSPs; }
/** * Removes <code>edge</code> from this tree. * If <code>remove_subtree</code> is <code>true</code>, removes * the subtree rooted at the child vertex incident to <code>edge</code>. * Otherwise, leaves the subtree intact as a new component tree of this * forest. * @param edge the edge to remove * @param remove_subtree if <code>true</code>, remove the subtree * @return <code>true</code> iff the tree was modified */ public boolean removeEdge(E edge, boolean remove_subtree) { if (!delegate.containsEdge(edge)) return false; V child = getDest(edge); if (remove_subtree) return removeVertex(child); else { delegate.removeEdge(edge); return false; } }
/** * Adds stack of edges to a graph * * @param graph * The graph to modify * @param edgeStack * The stack of edges to add */ protected void addPath(Graph<String, UnorderedPair<String>> graph, Stack<UnorderedPair<String>> edgeStack) { for (UnorderedPair<String> edge : edgeStack) { if (graph.containsEdge(edge) == false) { graph.addEdge(edge, edge.getFirst(), edge.getSecond()); if (graphVisualizer != null) { graphVisualizer.animate(graph, edge, edge.getFirst(), edge.getSecond()); } } } }
topo.addVertex(dst.getNode()); edgePresentInGraph = topo.containsEdge(edge); if (edgePresentInGraph == false) { try {
@Override public void loadGraphml() throws Exception { final G graph = factory.create(); MyGraphMLReader gmlr = loadGraphmlInGraph(urlPath, graph); Collection<String> verteces = graph.getVertices(); for (String vertex :verteces){ if(!entireGraph.containsVertex(vertex)){ entireGraph.addVertex(vertex); } } Collection<String> edges = graph.getEdges(); for (String edge : edges){ Pair<String> endpoints = graph.getEndpoints(edge); if (!entireGraph.containsEdge(edge)){ entireGraph.addEdge(edge,endpoints); } } graphMetadatas = gmlr.getGraphMetadata(); edgeMetadatas = gmlr.getEdgeMetadata(); vertexMetadatas = gmlr.getVertexMetadata(); notifyListeners(gmlr.getVertexMetadata(), gmlr.getEdgeMetadata(), graph); }