|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectfr.inria.opengve.bridge.algorithms.common.RandomWalk<V,E,G>
V - The type of verticesE - The type of links.public abstract class RandomWalk<V,E extends Link<V>,G extends Graph<V,E>>
| Constructor Summary | |
|---|---|
RandomWalk(G g)
Initialize random walk generator for a given graph and from a given vertex. |
|
RandomWalk(G g,
long seed)
Initialize random walk generator for a given graph and from a given vertex. |
|
| Method Summary | |
|---|---|
protected double[] |
computeProbability(E previousEdge,
java.util.Vector<E> edgeVector)
This method give the probability of each edge present in a given vector. |
abstract Path<V,E> |
createPath()
Create a new empty path. |
long |
getInitialSeed()
Return the seed used to initialize this random walk. |
Path<V,E> |
getNextPath(V source,
V destination)
Give the next random walk. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public RandomWalk(G g)
g - The graph on which random walk is done.
public RandomWalk(G g,
long seed)
g - The graph on which random walk is done.seed - The value used to initialize random generator.| Method Detail |
|---|
public abstract Path<V,E> createPath()
public Path<V,E> getNextPath(V source,
V destination)
source - The begining of the random walk.destination - The destination of the ramdom walk.
protected double[] computeProbability(E previousEdge,
java.util.Vector<E> edgeVector)
private E chooseNextEdge(Vector< E> edgeArray,Random randomGenerator) {
   double[] probability = computeProbability(edgeArray);
   double randValue = randomGenerator.nextDouble(); // Give a double value between 0.0 and 1.0
   for (int i = 0; i < probability.length; i++ ) {
     if (randValue <= probability[i]) { return edgeArray.get(i); }
   }
   // Never reach (just for java error)
   return null;
}result[result.lenght-1])
must be equal to 1 (one).By default this method implementation give the same probability to all the edges but each class extending this one can override this method to change probability computation.
previousEdge - The previously choosed edge or null if none.edgeVector - The vector of edge for which we want to compute probability.
public long getInitialSeed()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||