|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sun.sgs.impl.service.nodemap.affinity.BasicState
com.sun.sgs.impl.service.nodemap.affinity.AbstractLPA
public abstract class AbstractLPA
Abstract class implementing parts of the label propagation algorithm used by both the single node and distributed versions.
The following property is supported:
com.sun.sgs.impl.service.nodemap.affinity.numThreads
4
1 to run single-threaded.
Set logging to Level.FINEST for a trace of the algorithm (very verbose and slow). Set logging to Level.FINER to see the final labeled graph. Set logging to Level.FINE for any errors or unexpected conditions encountered during the run.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class com.sun.sgs.impl.service.nodemap.affinity.BasicState |
|---|
BasicState.State |
| Field Summary | |
|---|---|
static int |
DEFAULT_NUM_THREADS
The default value for the number of threads to use. |
protected ExecutorService |
executor
Our executor, for running tasks in parallel. |
protected edu.uci.ics.jung.graph.UndirectedGraph<LabelVertex,WeightedEdge> |
graph
The graph in which we're finding communities. |
protected int |
iterations
The number of iterations required for the last run. |
protected long |
localNodeId
The local node id. |
protected static LoggerWrapper |
logger
Our logger. |
static String |
NUM_THREADS_PROPERTY
The property name for the number of threads to use. |
protected int |
numThreads
The number of threads this algorithm should use. |
protected static String |
PROP_NAME
Our base property name. |
protected Random |
ran
A random number generator, to break ties. |
protected List<LabelVertex> |
vertices
For now, we're only grabbing the vertices of interest at the start of the algorithm. |
| Fields inherited from class com.sun.sgs.impl.service.nodemap.affinity.BasicState |
|---|
state |
| Constructor Summary | |
|---|---|
AbstractLPA(long nodeId,
Properties properties)
Constructs a new instance of the label propagation algorithm. |
|
| Method Summary | |
|---|---|
protected abstract void |
doOtherInitialization()
Perform any algorithm specific initialization for an algorithm run. |
protected abstract long |
doOtherNeighbors(LabelVertex vertex,
Map<Integer,Long> labelMap,
StringBuilder logSB)
Update the label map with any other neighbors known to a particular algorithm. |
protected static Set<AffinityGroup> |
gatherGroups(List<LabelVertex> vertices,
boolean reinitialize,
long gen)
Return the affinity groups found within the given vertices, putting all vertices with the same label in a group. |
protected void |
initializeLPARun(AffinityGraphBuilder builder)
Initialize ourselves for a run of the algorithm. |
protected boolean |
setMostFrequentLabel(LabelVertex vertex,
boolean self)
Sets the label of vertex to the label used most frequently
by vertex's neighbors. |
| Methods inherited from class com.sun.sgs.impl.service.nodemap.affinity.BasicState |
|---|
checkForDisabledOrShutdownState, checkForShutdownState, setDisabledState, setEnabledState, setShutdownState |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final String PROP_NAME
protected static final LoggerWrapper logger
public static final String NUM_THREADS_PROPERTY
public static final int DEFAULT_NUM_THREADS
protected final long localNodeId
protected final Random ran
protected final ExecutorService executor
protected final int numThreads
protected int iterations
protected volatile edu.uci.ics.jung.graph.UndirectedGraph<LabelVertex,WeightedEdge> graph
protected volatile List<LabelVertex> vertices
| Constructor Detail |
|---|
public AbstractLPA(long nodeId,
Properties properties)
throws Exception
nodeId - the local node IDproperties - the properties for configuring this service
IllegalArgumentException - if numThreads is
less than 1
Exception - if any other error occurs| Method Detail |
|---|
protected void initializeLPARun(AffinityGraphBuilder builder)
builder - the graph producerprotected abstract void doOtherInitialization()
protected boolean setMostFrequentLabel(LabelVertex vertex,
boolean self)
vertex to the label used most frequently
by vertex's neighbors. Returns true if vertex's
label changed.
vertex - a vertex in the graphself - true if we should pick our own label if it is
in the set of highest labels
true if vertex's label is changed, false
if it is not changed
protected abstract long doOtherNeighbors(LabelVertex vertex,
Map<Integer,Long> labelMap,
StringBuilder logSB)
vertex - the vertex whose neighbors labels will be examinedlabelMap - a map of labels to counts of neighbors using that labellogSB - a StringBuilder for gathering log info about neighbors
-1L if there are no other neighbors.
protected static Set<AffinityGroup> gatherGroups(List<LabelVertex> vertices,
boolean reinitialize,
long gen)
gen.
vertices - the vertices that we gather groups fromreinitialize - if true, reinitialize the labelsgen - the generation number
|
RedDwarf, Version 0.10.1 2010-03-14 10:56:12 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||