public class VoltageRanker
extends java.lang.Object
The resultant voltages will all be in the range [0, max]
where max is the largest voltage of any source vertex (in the
absence of negative source voltages; see below).
A few notes about this algorithm's interpretation of the graph data:
| Modifier and Type | Field and Description |
|---|---|
protected double |
convergence_threshold |
protected NumberEdgeValue |
edge_weights |
protected int |
max_iterations |
protected NumberVertexValue |
voltages |
| Constructor and Description |
|---|
VoltageRanker(NumberEdgeValue edge_weights,
NumberVertexValue voltages,
int num_iterations,
double convergence_threshold)
Creates an instance of
VoltageRanker which uses the
edge weights specified by edge_weights, and which stores
the voltages (ranks) as specified by voltages. |
VoltageRanker(NumberVertexValue voltages,
int num_iterations,
double threshold)
Creates an instance of
VoltageRanker which treats the
edges as though they were unweighted, and which stores
the voltages (ranks) as specified by voltages. |
| Modifier and Type | Method and Description |
|---|---|
void |
calculateVoltages(Graph g,
java.util.Map source_voltages,
java.util.Set sinks)
Calculates the voltages for
g based on the specified source
and sink vertex sets. |
void |
calculateVoltages(Graph g,
java.util.Set sources,
java.util.Set sinks)
Calculates the voltages for
g based on assigning each of the
vertices in source a voltage of 1 V. |
void |
calculateVoltages(Vertex source,
Vertex target)
Calculates an approximation of the solution of the Kirchhoff equations
for voltage, given that
source supplies 1 V and target
is tied to ground (O V). |
protected NumberEdgeValue edge_weights
protected NumberVertexValue voltages
protected int max_iterations
protected double convergence_threshold
public VoltageRanker(NumberEdgeValue edge_weights, NumberVertexValue voltages, int num_iterations, double convergence_threshold)
VoltageRanker which uses the
edge weights specified by edge_weights, and which stores
the voltages (ranks) as specified by voltages.public VoltageRanker(NumberVertexValue voltages, int num_iterations, double threshold)
VoltageRanker which treats the
edges as though they were unweighted, and which stores
the voltages (ranks) as specified by voltages.public void calculateVoltages(Graph g, java.util.Set sources, java.util.Set sinks)
g based on assigning each of the
vertices in source a voltage of 1 V.sources - vertices tied to 1 Vsinks - vertices tied to 0 VcalculateVoltages(Graph, Map, Set)public void calculateVoltages(Graph g, java.util.Map source_voltages, java.util.Set sinks)
g based on the specified source
and sink vertex sets.g - the graph for which voltages will be calculatedsource_voltages - a map from vertices to source voltage valuessinks - a set of vertices to tie to 0 Vpublic void calculateVoltages(Vertex source, Vertex target)
source supplies 1 V and target
is tied to ground (O V). Each other vertex will be assigned a voltage (rank)
in the range [0,1].source - the vertex whose voltage is tied to 1 Vtarget - the vertex whose voltage is tied to 0 V