本文整理了Java中edu.uci.ics.jung.graph.Graph.isNeighbor()
方法的一些代码示例,展示了Graph.isNeighbor()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Graph.isNeighbor()
方法的具体详情如下:
包路径:edu.uci.ics.jung.graph.Graph
类名称:Graph
方法名:isNeighbor
暂无
代码示例来源:origin: net.sourceforge.jadex/jadex-tools-comanalyzer
/**
* Returns <code>true</code> if <code>v1</code> and <code>v2</code> share an incident edge.
* Equivalent to <code>getNeighbors(v1).contains(v2)</code>.
*
* @param v1 the first vertex to test
* @param v2 the second vertex to test
* @return <code>true</code> if <code>v1</code> and <code>v2</code> share an incident edge
*/
public boolean isNeighbor(Object v1, Object v2)
{
return delegate.isNeighbor(v1, v2);
}
代码示例来源:origin: geogebra/geogebra
/**
* @see edu.uci.ics.jung.graph.Hypergraph#isNeighbor(java.lang.Object,
* java.lang.Object)
*/
@Override
public synchronized boolean isNeighbor(V v1, V v2) {
return delegate.isNeighbor(v1, v2);
}
代码示例来源:origin: net.sf.jung/jung-api
/**
* @see edu.uci.ics.jung.graph.Hypergraph#isNeighbor(java.lang.Object, java.lang.Object)
*/
public boolean isNeighbor(V v1, V v2) {
return delegate.isNeighbor(v1, v2);
}
代码示例来源:origin: net.sf.jung/jung-api
/**
* @see edu.uci.ics.jung.graph.Hypergraph#isNeighbor(java.lang.Object, java.lang.Object)
*/
public boolean isNeighbor(V v1, V v2) {
return delegate.isNeighbor(v1, v2);
}
代码示例来源:origin: geogebra/geogebra
/**
* @see edu.uci.ics.jung.graph.Hypergraph#isNeighbor(java.lang.Object,
* java.lang.Object)
*/
@Override
public boolean isNeighbor(V v1, V v2) {
return delegate.isNeighbor(v1, v2);
}
代码示例来源:origin: geogebra/geogebra
/**
* @see edu.uci.ics.jung.graph.Hypergraph#isNeighbor(java.lang.Object,
* java.lang.Object)
*/
@Override
public boolean isNeighbor(V v1, V v2) {
return delegate.isNeighbor(v1, v2);
}
代码示例来源:origin: net.sf.jung/jung-api
/**
* @see edu.uci.ics.jung.graph.Hypergraph#isNeighbor(java.lang.Object, java.lang.Object)
*/
public synchronized boolean isNeighbor(V v1, V v2) {
return delegate.isNeighbor(v1, v2);
}
代码示例来源:origin: net.sf.jung/jung-visualization
public boolean isNeighbor(V v1, V v2) {
return graph.isNeighbor(v1, v2);
}
public boolean isPredecessor(V v1, V v2) {
代码示例来源:origin: net.sourceforge.ondex.apps/ovtk2
private boolean end(List<V> candidates, List<V> already_found) {
// if a node in already_found is connected to all nodes in candidates
boolean end = false;
int edgecounter;
for (V found : already_found) {
edgecounter = 0;
for (V candidate : candidates) {
if (graph.isNeighbor(found, candidate)) {
edgecounter++;
} // of if
} // of for
if (edgecounter == candidates.size()) {
end = true;
}
} // of for
return end;
}
}
代码示例来源:origin: org.opendaylight.controller.thirdparty/net.sf.jung2
/**
* Make sure we have a canonical ordering: Returns true if u < w, or v < w <
* u and v doesn't link to w
*
* @param id
* @param u
* @param v
* @param w
* @return true if u < w, or if v < w < u and v doesn't link to w; false otherwise
*/
protected static <V,E> boolean shouldCount(Graph<V,E> g, List<V> id, V u, V v, V w) {
int i_u = id.indexOf(u);
int i_w = id.indexOf(w);
if (i_u < i_w)
return true;
int i_v = id.indexOf(v);
if ((i_v < i_w) && (i_w < i_u) && (!g.isNeighbor(w,v)))
return true;
return false;
}
}
代码示例来源:origin: net.sf.jung/jung-algorithms
/**
* Return true iff this ordering is canonical and therefore we should build statistics for it.
*
* @param g the graph whose properties are being examined
* @param id a list of the vertices in g; used to assign an index to each
* @param u a vertex in g
* @param v a vertex in g
* @param w a vertex in g
* @param <V> the vertex type
* @param <E> the edge type
* @return true if index(u) < index(w), or if index(v) < index(w) < index(u)
* and v doesn't link to w; false otherwise
*/
protected static <V,E> boolean shouldCount(Graph<V,E> g, List<V> id, V u, V v, V w) {
int i_u = id.indexOf(u);
int i_w = id.indexOf(w);
if (i_u < i_w)
return true;
int i_v = id.indexOf(v);
if ((i_v < i_w) && (i_w < i_u) && (!g.isNeighbor(w,v)))
return true;
return false;
}
}
代码示例来源:origin: geogebra/geogebra
/**
* Make sure we have a canonical ordering: Returns true if u < w, or v < w <
* u and v doesn't link to w
*
* @param id
* @param u
* @param v
* @param w
* @return true if u < w, or if v < w < u and v doesn't link to w; false
* otherwise
*/
protected static <V, E> boolean shouldCount(Graph<V, E> g, List<V> id, V u,
V v, V w) {
int i_u = id.indexOf(u);
int i_w = id.indexOf(w);
if (i_u < i_w) {
return true;
}
int i_v = id.indexOf(v);
if ((i_v < i_w) && (i_w < i_u) && (!g.isNeighbor(w, v))) {
return true;
}
return false;
}
}
代码示例来源:origin: net.sourceforge.ondex.apps/ovtk2
if (graph.isNeighbor(candidate, new_candidate)) {
new_candidates.add(new_candidate);
if (graph.isNeighbor(candidate, new_found)) {
new_already_found.add(new_found);
代码示例来源:origin: net.sf.jung/jung-algorithms
edge_count += graph.isNeighbor(w, x) ? 1 : 0;
代码示例来源:origin: geogebra/geogebra
for (int j = i + 1; j < n; j++) {
V x = neighbors.get(j);
edge_count += graph.isNeighbor(w, x) ? 1 : 0;
代码示例来源:origin: org.opendaylight.controller.thirdparty/net.sf.jung2
edge_count += graph.isNeighbor(w, x) ? 1 : 0;
代码示例来源:origin: net.sf.jung/jung-algorithms
private void evolveGraph() {
Collection<V> preexistingNodes = mGraph.getVertices();
V newVertex = vertexFactory.get();
mGraph.addVertex(newVertex);
// generate and store the new edges; don't add them to the graph
// yet because we don't want to bias the degree calculations
// (all new edges in a timestep should be added in parallel)
Set<Pair<V>> added_pairs = createRandomEdges(preexistingNodes, newVertex, mNumEdgesToAttachPerStep);
for (Pair<V> pair : added_pairs) {
V v1 = pair.getFirst();
V v2 = pair.getSecond();
if (mGraph.getDefaultEdgeType() != EdgeType.UNDIRECTED || !mGraph.isNeighbor(v1, v2))
mGraph.addEdge(edgeFactory.get(), pair);
}
// now that we're done attaching edges to this new vertex,
// add it to the index
vertex_index.add(newVertex);
index_vertex.put(newVertex, new Integer(vertex_index.size() - 1));
}
代码示例来源:origin: geogebra/geogebra
private void evolveGraph() {
V newVertex = vertexFactory.create();
mGraph.addVertex(newVertex);
// generate and store the new edges; don't add them to the graph
// yet because we don't want to bias the degree calculations
// (all new edges in a timestep should be added in parallel)
Set<Pair<V>> added_pairs = new HashSet<Pair<V>>(
mNumEdgesToAttachPerStep * 3);
for (int i = 0; i < mNumEdgesToAttachPerStep; i++) {
createRandomEdge(newVertex, added_pairs);
}
for (Pair<V> pair : added_pairs) {
V v1 = pair.getFirst();
V v2 = pair.getSecond();
if (mGraph.getDefaultEdgeType() != EdgeType.UNDIRECTED
|| !mGraph.isNeighbor(v1, v2)) {
mGraph.addEdge(edgeFactory.create(), pair);
}
}
// now that we're done attaching edges to this new vertex,
// add it to the index
vertex_index.add(newVertex);
index_vertex.put(newVertex, Integer.valueOf(vertex_index.size() - 1));
}
代码示例来源:origin: org.opendaylight.controller.thirdparty/net.sf.jung2
private void evolveGraph() {
Collection<V> preexistingNodes = mGraph.getVertices();
V newVertex = vertexFactory.create();
mGraph.addVertex(newVertex);
// generate and store the new edges; don't add them to the graph
// yet because we don't want to bias the degree calculations
// (all new edges in a timestep should be added in parallel)
Set<Pair<V>> added_pairs = new HashSet<Pair<V>>(mNumEdgesToAttachPerStep*3);
for (int i = 0; i < mNumEdgesToAttachPerStep; i++)
createRandomEdge(preexistingNodes, newVertex, added_pairs);
for (Pair<V> pair : added_pairs)
{
V v1 = pair.getFirst();
V v2 = pair.getSecond();
if (mGraph.getDefaultEdgeType() != EdgeType.UNDIRECTED ||
!mGraph.isNeighbor(v1, v2))
mGraph.addEdge(edgeFactory.create(), pair);
}
// now that we're done attaching edges to this new vertex,
// add it to the index
vertex_index.add(newVertex);
index_vertex.put(newVertex, new Integer(vertex_index.size() - 1));
}
内容来源于网络,如有侵权,请联系作者删除!