From: BFL: a node and edge betweenness based fast layout algorithm for large scale networks
1: procedure ANNEAL(v,threshold) |
---|
2: Set currentCoord ← v.coordinate |
3: Set currentEnergy ← EnergyOf(v, currentCoord) |
4: Set bestCoord ← currentCoord |
5: Set bestEnergy ← currentEnergy |
6: Set k ← 0 |
7: while currentEnergy – tempEnergy > threshold AND k < kmax do ▹ kmax is some constant to cut off runaway calculations |
8: Set tempCoord ← newNeighbor(currentCoord,v) |
9: Set tempEnergy ← EnergyOf(v,tempCoord) |
10: if bestEnergy > tempEnergy then |
11: Set bestEnergy ← tempEnergy |
12: Set bestCoord ← tempCoord |
13: end if |
14: if transition(currentEnergy, tempEnergy, k) then |
15: Set currentCoord ← tempCoord |
16: Set currentEnergy ← tempEnergy |
17: end if |
18: end while |
19: Set v.coordinate ← bestCoord |
20: end procedure |
21: procedure NEW NEIGHBOR(currentCoord,v) |
22: Return Gaussian centered at currentCoord with deviation c2Ln(N odeBC [v] + 1)3 |
23: end procedure |
24: procedure TRANSITION(currentEnergy,tempEnergy,k) |
25: Set temp ← (kmax - k)3 |
26: Set transition ← e(currentEnergy-tempEnergy)/temp |
27: Set rand ← random value from 0 to 1 |
28: if rand < transition then |
29: Return true |
30: else |
31: Return false |
32: end if |
33: end procedure |