nct.graph.util
Class EdgeWeightShuffle<NodeType extends java.lang.Comparable<? super NodeType>,WeightType extends java.lang.Comparable<? super WeightType>>

java.lang.Object
  extended by nct.graph.util.EdgeWeightShuffle<NodeType,WeightType>
All Implemented Interfaces:
GraphRandomizer<NodeType,WeightType>

public class EdgeWeightShuffle<NodeType extends java.lang.Comparable<? super NodeType>,WeightType extends java.lang.Comparable<? super WeightType>>
extends java.lang.Object
implements GraphRandomizer<NodeType,WeightType>

This class performs a basic Fisher-Yates shuffle of the edge weights. It creates a list of edges and then shuffles the weights within that list.


Field Summary
protected  java.util.Random rand
           
 
Constructor Summary
EdgeWeightShuffle(java.util.Random r)
           
 
Method Summary
 void randomize(Graph<NodeType,WeightType> g)
          Basic Fisher-Yates edge weight shuffle.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

rand

protected java.util.Random rand
Constructor Detail

EdgeWeightShuffle

public EdgeWeightShuffle(java.util.Random r)
Method Detail

randomize

public void randomize(Graph<NodeType,WeightType> g)
Basic Fisher-Yates edge weight shuffle.

Specified by:
randomize in interface GraphRandomizer<NodeType extends java.lang.Comparable<? super NodeType>,WeightType extends java.lang.Comparable<? super WeightType>>
Parameters:
g - The graph whose edge weights should be shuffled.