/** Updates the value for this node. Called by <code>step()</code>. */ @Override public double update(N v) { collectDisappearingPotential(v); double v_input = 0; for (N u : graph.predecessors(v)) { for (E e : graph.edgesConnecting(u, v)) { v_input += (getCurrentValue(u) * getEdgeWeight(u, e).doubleValue()); } } // modify total_input according to alpha double new_value = alpha > 0 ? v_input * (1 - alpha) + getNodePrior(v) * alpha : v_input; setOutputValue(v, new_value); return Math.abs(getCurrentValue(v) - new_value); }
/** * Updates the value for this vertex. Called by <code>step()</code>. */ @Override public double update(V v) { collectDisappearingPotential(v); double v_input = 0; for (E e : graph.getInEdges(v)) { // For graphs, the code below is equivalent to // V w = graph.getOpposite(v, e); // total_input += (getCurrentValue(w) * // getEdgeWeight(w,e).doubleValue()); // For hypergraphs, this divides the potential coming from w // by the number of vertices in the connecting edge e. int incident_count = getAdjustedIncidentCount(e); for (V w : graph.getIncidentVertices(e)) { if (!w.equals(v) || hyperedges_are_self_loops) { v_input += (getCurrentValue(w) * getEdgeWeight(w, e).doubleValue() / incident_count); } } } // modify total_input according to alpha double new_value = alpha > 0 ? v_input * (1 - alpha) + getVertexPrior(v) * alpha : v_input; setOutputValue(v, new_value); return Math.abs(getCurrentValue(v) - new_value); }
public double update(V v) collectDisappearingPotential(v);
public double update(V v) collectDisappearingPotential(v);