/** * @see edu.uci.ics.jung.graph.Hypergraph#getNeighbors(java.lang.Object) */ @Override public synchronized Collection<V> getNeighbors(V vertex) { return delegate.getNeighbors(vertex); }
/** * @see edu.uci.ics.jung.graph.Hypergraph#getNeighbors(java.lang.Object) */ @Override public Collection<V> getNeighbors(V vertex) { return delegate.getNeighbors(vertex); }
/** * @see edu.uci.ics.jung.graph.Hypergraph#getNeighbors(java.lang.Object) */ public synchronized Collection<V> getNeighbors(V vertex) { return delegate.getNeighbors(vertex); }
/** * @see edu.uci.ics.jung.graph.Hypergraph#getNeighbors(java.lang.Object) */ public Collection<V> getNeighbors(V vertex) { return delegate.getNeighbors(vertex); }
/** * @see edu.uci.ics.jung.graph.Hypergraph#getNeighbors(java.lang.Object) */ @Override public Collection<V> getNeighbors(V vertex) { return delegate.getNeighbors(vertex); }
/** * @see edu.uci.ics.jung.graph.Hypergraph#getNeighbors(java.lang.Object) */ public Collection<V> getNeighbors(V vertex) { return delegate.getNeighbors(vertex); }
/** * 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); }
public Collection<V> getNeighbors(V vertex) { return graph.getNeighbors(vertex); } public V getOpposite(V vertex, E edge) {
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); } }
/** * 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; }
for (V w : g.getNeighbors(v1)) {
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; }
/** * 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; }
/** * 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; }
/** * 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; }
/** * 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; }
for (V v : g.getNeighbors(v1)) { denominator += mutualWeight(v1, v);
/** * 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); }
/** * 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); }
/** * 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); }