/** * {@inheritDoc} */ @Override public boolean containsVertex(V v) { return delegate.containsVertex(v); }
/** * {@inheritDoc} */ @Override public boolean containsVertex(V v) { return g1.containsVertex(v) || g2.containsVertex(v); }
@Override public Integer get() { while(graph.containsVertex(nextId)) { ++nextId; } //graph.addVertex(nextId); return nextId; }
public boolean containsVertex( FlowElement flowElement ) { return graph.containsVertex( flowElement ); }
/** * Returns the vertex if vertex is a cutpoint, and otherwise returns the block (biconnected * component) containing the vertex. * * @param vertex vertex * @return the biconnected component containing the vertex */ public Graph<V, E> getBlock(V vertex) { assert this.graph.containsVertex(vertex); return this.vertex2block.get(vertex); }
/** * {@inheritDoc} */ @Override public Double getVertexScore(V v) { if (!g.containsVertex(v)) { throw new IllegalArgumentException("Cannot return score of unknown vertex"); } return scores.get(v); }
/** * {@inheritDoc} */ @Override public Double getVertexScore(V v) { if (!g.containsVertex(v)) { throw new IllegalArgumentException("Cannot return score of unknown vertex"); } return scores.get(v); }
/** * {@inheritDoc} */ @Override public E getEdge(V sourceVertex, V targetVertex) { E res = null; if (g1.containsVertex(sourceVertex) && g1.containsVertex(targetVertex)) { res = g1.getEdge(sourceVertex, targetVertex); } if ((res == null) && g2.containsVertex(sourceVertex) && g2.containsVertex(targetVertex)) { res = g2.getEdge(sourceVertex, targetVertex); } return res; }
/** * {@inheritDoc} */ @Override public double getPathWeight(V source, V sink) { if (!graph.containsVertex(source)) { throw new IllegalArgumentException(GRAPH_MUST_CONTAIN_THE_SOURCE_VERTEX); } if (!graph.containsVertex(sink)) { throw new IllegalArgumentException(GRAPH_MUST_CONTAIN_THE_SINK_VERTEX); } lazyCalculateMatrix(); return d[vertexIndices.get(source)][vertexIndices.get(sink)]; }
/** * {@inheritDoc} */ @Override public Integer getVertexScore(V v) { if (!g.containsVertex(v)) { throw new IllegalArgumentException("Cannot return score of unknown vertex"); } lazyRun(); return scores.get(v); }
/** * {@inheritDoc} */ @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); }
/** * Makes sure that every requested destination is contained in the graph. */ private void verifyDestinations() { for (VAccess dest : destinations) { if (!graph.containsVertex(dest)) { throw new IllegalArgumentException( "Destination " + dest.getID() + " is not contained " + "in the graph."); } } } }
/** * {@inheritDoc} */ @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); }
/** * Get a vertex's local clustering coefficient * * @param v the vertex * @return the local clustering coefficient */ @Override public Double getVertexScore(V v) { if (!graph.containsVertex(v)) { throw new IllegalArgumentException("Cannot return score of unknown vertex"); } return computeLocalClusteringCoefficient(v); } }
@Override public boolean addHeadVertex( FlowElement flowElement ) { if( !graph.containsVertex( Extent.head ) ) graph.addVertex( Extent.head ); if( flowElement == Extent.head ) return false; boolean result = true; if( !graph.containsVertex( flowElement ) ) result = graph.addVertex( flowElement ); return result && graph.addEdge( Extent.head, flowElement ) != null; }
@Override public boolean addTailVertex( FlowElement flowElement ) { if( !graph.containsVertex( Extent.tail ) ) graph.addVertex( Extent.tail ); if( flowElement == Extent.tail ) return false; boolean result = true; if( !graph.containsVertex( flowElement ) ) result = graph.addVertex( flowElement ); return result && graph.addEdge( flowElement, Extent.tail ) != null; }
/** * {@inheritDoc} * * @throws NegativeCycleDetectedException in case a negative weight cycle is detected */ @Override public GraphPath<V, E> getPath(V source, V sink) { if (!graph.containsVertex(sink)) { throw new IllegalArgumentException(GRAPH_MUST_CONTAIN_THE_SINK_VERTEX); } return getPaths(source).getPath(sink); }
@Override public MultiObjectiveSingleSourcePaths<V, E> getPaths(V source) { if (!graph.containsVertex(source)) { throw new IllegalArgumentException(GRAPH_MUST_CONTAIN_THE_SOURCE_VERTEX); } Map<V, List<GraphPath<V, E>>> paths = new HashMap<>(); for (V v : graph.vertexSet()) { paths.put(v, getPaths(source, v)); } return new ListMultiObjectiveSingleSourcePathsImpl<>(graph, source, paths); }
/** * {@inheritDoc} */ @Override public SingleSourcePaths<V, E> getPaths(V source) { if (!graph.containsVertex(source)) { throw new IllegalArgumentException("graph must contain the source vertex"); } Map<V, GraphPath<V, E>> paths = new HashMap<>(); for (V v : graph.vertexSet()) { paths.put(v, getPath(source, v)); } return new ListSingleSourcePathsImpl<>(graph, source, paths); }
/** * {@inheritDoc} */ @Override public boolean removeVertex(V v) { // If the base graph does NOT contain v it means we are here in // response to removal of v from the base. In such case we don't need // to remove all the edges of v as they were already removed. if (containsVertex(v) && base.containsVertex(v)) { removeAllEdges(edgesOf(v)); } return vertexSet.remove(v); }