com.sun.sgs.impl.service.nodemap.affinity.graph
Class LabelVertex

java.lang.Object
  extended by com.sun.sgs.impl.service.nodemap.affinity.graph.LabelVertex

public final class LabelVertex
extends Object

Vertices for a Label Propagation Algorithm graph. Labels change as we iterate through the algorithm, and once the algorithm has converged after several iterations, vertices with the same label are in the same cluster.

We are using the identity's hash code for the label for faster comparisons. This has some risk of us clustering identities that actually are not related, because hash codes are not guaranteed to be unique.


Constructor Summary
LabelVertex(Identity id)
          Constructs a new vertex representing the given id and initializes the label information to the hashcode of the id.
 
Method Summary
 boolean equals(Object o)
          
 Identity getIdentity()
          Returns the identity this vertex represents.
 int getLabel()
          Returns the current label for this vertex.
 int hashCode()
          
 void initializeLabel()
          Sets the label to the initial value.
 void setLabel(int newLabel)
          Sets the label to a new value.
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LabelVertex

public LabelVertex(Identity id)
Constructs a new vertex representing the given id and initializes the label information to the hashcode of the id.

Parameters:
id - the identity this vertex represents
Method Detail

initializeLabel

public void initializeLabel()
Sets the label to the initial value.


equals

public boolean equals(Object o)

We do no take the current label into account when calculating equals.

Overrides:
equals in class Object

hashCode

public int hashCode()

Overrides:
hashCode in class Object

toString

public String toString()

Overrides:
toString in class Object

setLabel

public void setLabel(int newLabel)
Sets the label to a new value.

Parameters:
newLabel - the new label value

getLabel

public int getLabel()
Returns the current label for this vertex.

Returns:
the current label for this vertex

getIdentity

public Identity getIdentity()
Returns the identity this vertex represents.

Returns:
the identity this vertex represents

RedDwarf, Version 0.10.1
2010-03-14 10:56:12

Copyright © 2010 The RedDwarf Authors. All rights reserved
Copyright © 2007-2010 Sun Microsystems, Inc. All rights reserved