本文整理了Java中edu.uci.ics.jung.graph.Graph.getNeighbors()
方法的一些代码示例,展示了Graph.getNeighbors()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Graph.getNeighbors()
方法的具体详情如下:
包路径:edu.uci.ics.jung.graph.Graph
类名称:Graph
方法名:getNeighbors
暂无
代码示例来源:origin: geogebra/geogebra
/**
* @see edu.uci.ics.jung.graph.Hypergraph#getNeighbors(java.lang.Object)
*/
@Override
public synchronized Collection<V> getNeighbors(V vertex) {
return delegate.getNeighbors(vertex);
}
代码示例来源:origin: geogebra/geogebra
/**
* @see edu.uci.ics.jung.graph.Hypergraph#getNeighbors(java.lang.Object)
*/
@Override
public Collection<V> getNeighbors(V vertex) {
return delegate.getNeighbors(vertex);
}
代码示例来源:origin: net.sf.jung/jung-api
/**
* @see edu.uci.ics.jung.graph.Hypergraph#getNeighbors(java.lang.Object)
*/
public synchronized Collection<V> getNeighbors(V vertex) {
return delegate.getNeighbors(vertex);
}
代码示例来源:origin: net.sf.jung/jung-api
/**
* @see edu.uci.ics.jung.graph.Hypergraph#getNeighbors(java.lang.Object)
*/
public Collection<V> getNeighbors(V vertex) {
return delegate.getNeighbors(vertex);
}
代码示例来源:origin: geogebra/geogebra
/**
* @see edu.uci.ics.jung.graph.Hypergraph#getNeighbors(java.lang.Object)
*/
@Override
public Collection<V> getNeighbors(V vertex) {
return delegate.getNeighbors(vertex);
}
代码示例来源:origin: net.sf.jung/jung-api
/**
* @see edu.uci.ics.jung.graph.Hypergraph#getNeighbors(java.lang.Object)
*/
public Collection<V> getNeighbors(V vertex) {
return delegate.getNeighbors(vertex);
}
代码示例来源:origin: net.sourceforge.jadex/jadex-tools-comanalyzer
/**
* Returns the neighbor vertices of a given vertex.
* @param vertex The vertex.
* @return The collection of neighbors.
*/
public Collection getNeighbors(Object vertex)
{
return delegate.getNeighbors(vertex);
}
代码示例来源:origin: net.sf.jung/jung-visualization
public Collection<V> getNeighbors(V vertex) {
return graph.getNeighbors(vertex);
}
public V getOpposite(V vertex, E edge) {
代码示例来源:origin: stackoverflow.com
public int countReachable(int root, boolean[] visited, boolean[] ignored, Graph graph) {
if (ignored[root]) {
return 0;
}
Stack<Integer> stack = new Stack<>();
stack.push(root);
int count = 0;
while (stack.empty() == false) {
int node = stack.pop();
if (visited[node] == false) {
count++;
visited[node] = true;
for (int neighbor : graph.getNeighbors(node)) {
if (visited[neighbor] == false) {
stack.push(neighbor);
}
}
}
}
if (count * 2 >= graph.numNodes()) {
return markAndCountAncestors(root, visited, ignored, graph);
} else {
return markSuccessors(root, visited, ignored, graph);
}
}
代码示例来源:origin: org.opendaylight.controller.thirdparty/net.sf.jung2
/**
* Burt's measure of the effective size of a vertex's network. Essentially, the
* number of neighbors minus the average degree of those in <code>v</code>'s neighbor set,
* not counting ties to <code>v</code>. Formally:
* <pre>
* effectiveSize(v) = v.degree() - (sum_{u in N(v)} sum_{w in N(u), w !=u,v} p(v,w)*m(u,w))
* </pre>
* where
* <ul>
* <li/><code>N(a) = a.getNeighbors()</code>
* <li/><code>p(v,w) =</code> normalized mutual edge weight of v and w
* <li/><code>m(u,w)</code> = maximum-scaled mutual edge weight of u and w
* </ul>
* @see #normalizedMutualEdgeWeight(Object, Object)
* @see #maxScaledMutualEdgeWeight(Object, Object)
*/
public double effectiveSize(V v)
{
double result = g.degree(v);
for(V u : g.getNeighbors(v)) {
for(V w : g.getNeighbors(u)) {
if (w != v && w != u)
result -= normalizedMutualEdgeWeight(v,w) *
maxScaledMutualEdgeWeight(u,w);
}
}
return result;
}
代码示例来源:origin: org.opendaylight.controller.thirdparty/net.sf.jung2
for (V w : g.getNeighbors(v1)) {
代码示例来源:origin: net.sf.jung/jung-samples
public Stroke apply(V v)
{
if (highlight)
{
if (pi.isPicked(v))
return heavy;
else
{
for(V w : graph.getNeighbors(v)) {
// for (Iterator iter = graph.getNeighbors(v)v.getNeighbors().iterator(); iter.hasNext(); )
// {
// Vertex w = (Vertex)iter.next();
if (pi.isPicked(w))
return medium;
}
return light;
}
}
else
return light;
}
代码示例来源:origin: org.opendaylight.controller.thirdparty/net.sf.jung2
/**
* The aggregate constraint on <code>v</code>. Based on Burt's equation 2.7.
* Formally:
* <pre>
* aggregateConstraint(v) = sum_{w in N(v)} localConstraint(v,w) * O(w)
* </pre>
* where
* <ul>
* <li/><code>N(v) = v.getNeighbors()</code>
* <li/><code>O(w) = organizationalMeasure(w)</code>
* </ul>
*/
public double aggregateConstraint(V v)
{
double result = 0;
for (V w : g.getNeighbors(v)) {
result += localConstraint(v, w) * organizationalMeasure(g, w);
}
return result;
}
代码示例来源:origin: geogebra/geogebra
/**
* The aggregate constraint on <code>v</code>. Based on Burt's equation 2.7.
* Formally:
*
* <pre>
* aggregateConstraint(v) = sum_{w in N(v)} localConstraint(v,w) * O(w)
* </pre>
*
* where
* <ul>
* <li/><code>N(v) = v.getNeighbors()</code>
* <li/><code>O(w) = organizationalMeasure(w)</code>
* </ul>
*/
public double aggregateConstraint(V v) {
double result = 0;
for (V w : g.getNeighbors(v)) {
result += localConstraint(v, w) * organizationalMeasure(g, w);
}
return result;
}
代码示例来源:origin: net.sf.jung/jung-algorithms
/**
* The aggregate constraint on <code>v</code>. Based on Burt's equation 2.7.
* Formally:
* <pre>
* aggregateConstraint(v) = sum_{w in N(v)} localConstraint(v,w) * O(w)
* </pre>
* where
* <ul>
* <li><code>N(v) = v.getNeighbors()</code>
* <li><code>O(w) = organizationalMeasure(w)</code>
* </ul>
*
* @param v the vertex whose properties are being measured
* @return the aggregate constraint on v
*/
public double aggregateConstraint(V v)
{
double result = 0;
for (V w : g.getNeighbors(v)) {
result += localConstraint(v, w) * organizationalMeasure(g, w);
}
return result;
}
代码示例来源:origin: org.opendaylight.controller.thirdparty/net.sf.jung2
/**
* Returns the proportion of <code>v1</code>'s network time and energy invested
* in the relationship with <code>v2</code>. Formally:
* <pre>
* normalizedMutualEdgeWeight(a,b) = mutual_weight(a,b) / (sum_c mutual_weight(a,c))
* </pre>
* Returns 0 if either numerator or denominator = 0, or if <code>v1 == v2</code>.
* @see #mutualWeight(Object, Object)
*/
protected double normalizedMutualEdgeWeight(V v1, V v2)
{
if (v1 == v2)
return 0;
double numerator = mutualWeight(v1, v2);
if (numerator == 0)
return 0;
double denominator = 0;
for (V v : g.getNeighbors(v1)) {
denominator += mutualWeight(v1, v);
}
if (denominator == 0)
return 0;
return numerator / denominator;
}
代码示例来源:origin: net.sf.jung/jung-algorithms
for (V v : g.getNeighbors(v1)) {
denominator += mutualWeight(v1, v);
代码示例来源:origin: org.opendaylight.controller.thirdparty/net.sf.jung2
/**
* Returns the local constraint on <code>v</code> from a lack of primary holes
* around its neighbor <code>v2</code>.
* Based on Burt's equation 2.4. Formally:
* <pre>
* localConstraint(v1, v2) = ( p(v1,v2) + ( sum_{w in N(v)} p(v1,w) * p(w, v2) ) )^2
* </pre>
* where
* <ul>
* <li/><code>N(v) = v.getNeighbors()</code>
* <li/><code>p(v,w) =</code> normalized mutual edge weight of v and w
* </ul>
* @see #normalizedMutualEdgeWeight(Object, Object)
*/
public double localConstraint(V v1, V v2)
{
double nmew_vw = normalizedMutualEdgeWeight(v1, v2);
double inner_result = 0;
for (V w : g.getNeighbors(v1)) {
inner_result += normalizedMutualEdgeWeight(v1,w) *
normalizedMutualEdgeWeight(w,v2);
}
return (nmew_vw + inner_result) * (nmew_vw + inner_result);
}
代码示例来源:origin: geogebra/geogebra
/**
* Returns the local constraint on <code>v</code> from a lack of primary
* holes around its neighbor <code>v2</code>. Based on Burt's equation 2.4.
* Formally:
*
* <pre>
* localConstraint(v1, v2) = ( p(v1,v2) + ( sum_{w in N(v)} p(v1,w) * p(w, v2) ) )^2
* </pre>
*
* where
* <ul>
* <li/><code>N(v) = v.getNeighbors()</code>
* <li/><code>p(v,w) =</code> normalized mutual edge weight of v and w
* </ul>
*
* @see #normalizedMutualEdgeWeight(Object, Object)
*/
public double localConstraint(V v1, V v2) {
double nmew_vw = normalizedMutualEdgeWeight(v1, v2);
double inner_result = 0;
for (V w : g.getNeighbors(v1)) {
inner_result += normalizedMutualEdgeWeight(v1, w)
* normalizedMutualEdgeWeight(w, v2);
}
return (nmew_vw + inner_result) * (nmew_vw + inner_result);
}
代码示例来源:origin: net.sf.jung/jung-algorithms
/**
* Returns the local constraint on <code>v1</code> from a lack of primary holes
* around its neighbor <code>v2</code>.
* Based on Burt's equation 2.4. Formally:
* <pre>
* localConstraint(v1, v2) = ( p(v1,v2) + ( sum_{w in N(v)} p(v1,w) * p(w, v2) ) )^2
* </pre>
* where
* <ul>
* <li><code>N(v) = v.getNeighbors()</code>
* <li><code>p(v,w) =</code> normalized mutual edge weight of v and w
* </ul>
* @param v1 the first vertex whose local constraint is desired
* @param v2 the second vertex whose local constraint is desired
* @return the local constraint on (v1, v2)
* @see #normalizedMutualEdgeWeight(Object, Object)
*/
public double localConstraint(V v1, V v2)
{
double nmew_vw = normalizedMutualEdgeWeight(v1, v2);
double inner_result = 0;
for (V w : g.getNeighbors(v1)) {
inner_result += normalizedMutualEdgeWeight(v1,w) *
normalizedMutualEdgeWeight(w,v2);
}
return (nmew_vw + inner_result) * (nmew_vw + inner_result);
}
内容来源于网络,如有侵权,请联系作者删除!