本文整理了Java中org.jgrapht.Graph.containsVertex()
方法的一些代码示例,展示了Graph.containsVertex()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Graph.containsVertex()
方法的具体详情如下:
包路径:org.jgrapht.Graph
类名称:Graph
方法名:containsVertex
[英]Returns true if this graph contains the specified vertex. More formally, returns true if and only if this graph contains a vertex u
such that u.equals(v)
. If the specified vertex is null
returns false
.
[中]如果此图形包含指定的顶点,则返回true。更正式地说,当且仅当此图包含一个顶点u
,即u.equals(v)
时,返回true。如果指定的顶点为null
,则返回false
。
代码示例来源:origin: org.jgrapht/jgrapht-core
/**
* {@inheritDoc}
*/
@Override
public boolean containsVertex(V v)
{
return delegate.containsVertex(v);
}
代码示例来源:origin: org.jgrapht/jgrapht-core
/**
* {@inheritDoc}
*/
@Override
public boolean containsVertex(V v)
{
return g1.containsVertex(v) || g2.containsVertex(v);
}
代码示例来源:origin: SmartDataAnalytics/jena-sparql-api
@Override
public Integer get() {
while(graph.containsVertex(nextId)) {
++nextId;
}
//graph.addVertex(nextId);
return nextId;
}
代码示例来源:origin: cwensel/cascading
public boolean containsVertex( FlowElement flowElement )
{
return graph.containsVertex( flowElement );
}
代码示例来源:origin: org.jgrapht/jgrapht-core
/**
* 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);
}
代码示例来源:origin: org.jgrapht/jgrapht-core
/**
* {@inheritDoc}
*/
@Override
public Double getVertexScore(V v)
{
if (!g.containsVertex(v)) {
throw new IllegalArgumentException("Cannot return score of unknown vertex");
}
return scores.get(v);
}
代码示例来源:origin: org.jgrapht/jgrapht-core
/**
* {@inheritDoc}
*/
@Override
public Double getVertexScore(V v)
{
if (!g.containsVertex(v)) {
throw new IllegalArgumentException("Cannot return score of unknown vertex");
}
return scores.get(v);
}
代码示例来源:origin: org.jgrapht/jgrapht-core
/**
* {@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;
}
代码示例来源:origin: org.jgrapht/jgrapht-core
/**
* {@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)];
}
代码示例来源:origin: org.jgrapht/jgrapht-core
/**
* {@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);
}
代码示例来源:origin: org.jgrapht/jgrapht-core
/**
* {@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);
}
代码示例来源:origin: org.orbisgis/java-network-analyzer
/**
* 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.");
}
}
}
}
代码示例来源:origin: org.jgrapht/jgrapht-core
/**
* {@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);
}
代码示例来源:origin: org.jgrapht/jgrapht-core
/**
* 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);
}
}
代码示例来源:origin: cwensel/cascading
@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;
}
代码示例来源:origin: cwensel/cascading
@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;
}
代码示例来源:origin: org.jgrapht/jgrapht-core
/**
* {@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);
}
代码示例来源:origin: org.jgrapht/jgrapht-core
@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);
}
代码示例来源:origin: org.jgrapht/jgrapht-core
/**
* {@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);
}
代码示例来源:origin: org.jgrapht/jgrapht-core
/**
* {@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);
}
内容来源于网络,如有侵权,请联系作者删除!