/** * Cleans up after each step. In this case that involves allocating the * disappearing potential (thus maintaining normalization of the scores) * according to the vertex probability priors, and then calling * <code>super.afterStep</code>. */ @Override protected void afterStep() { // distribute disappearing potential according to priors if (disappearing_potential > 0) { for (V v : graph.getVertices()) { setOutputValue(v, getOutputValue(v) + (1 - alpha) * (disappearing_potential * getVertexPrior(v))); } disappearing_potential = 0; } super.afterStep(); }
/** * Cleans up after each step. In this case that involves allocating the disappearing * potential (thus maintaining normalization of the scores) according to the vertex * probability priors, and then calling * <code>super.afterStep</code>. */ @Override protected void afterStep() { // distribute disappearing potential according to priors if (disappearing_potential > 0) { for (V v : graph.getVertices()) { setOutputValue(v, getOutputValue(v) + (1 - alpha) * (disappearing_potential * getVertexPrior(v))); } disappearing_potential = 0; } super.afterStep(); }
/** * Cleans up after each step. In this case that involves allocating the disappearing * potential (thus maintaining normalization of the scores) according to the vertex * probability priors, and then calling * <code>super.afterStep</code>. */ @Override protected void afterStep() { // distribute disappearing potential according to priors if (disappearing_potential > 0) { for (V v : graph.getVertices()) { setOutputValue(v, getOutputValue(v) + (1 - alpha) * (disappearing_potential * getVertexPrior(v))); } disappearing_potential = 0; } super.afterStep(); }
/** * 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); }
v_input * (1 - alpha) + getVertexPrior(v) * alpha : v_input; setOutputValue(v, new_value);
v_input * (1 - alpha) + getVertexPrior(v) * alpha : v_input; setOutputValue(v, new_value);