|
||||||||||
| 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
com.sun.sgs.impl.service.nodemap.affinity.dlpa.LabelPropagation
public class LabelPropagation
A distributed implementation of the algorithm presented in "Near linear time algorithm to detect community structures in large-scale networks" by U.N. Raghavan, R. Albert and S. Kumara 2007.
This is the portion of code that is on each application node.
The following properties are supported:
com.sun.sgs.impl.service.nodemap.affinity.server.host
com.sun.sgs.server.host
property, if present, or localhost if this node is starting the
server NodeMappingServer.
com.sun.sgs.impl.service.nodemap.affinity.server.port
44537
LabelPropagationServer. This value must be no less than 0 and
no greater than 65535.
com.sun.sgs.impl.service.nodemap.affinity.client.port
0 (anonymous port)
LabelPropagationServer.
This value must be no less than 0 and no greater than
65535.
| Field Summary | |
|---|---|
(package private) static String |
SERVER_HOST_PROPERTY
The property name for the server host. |
| Fields inherited from class com.sun.sgs.impl.service.nodemap.affinity.AbstractLPA |
|---|
DEFAULT_NUM_THREADS, executor, graph, iterations, localNodeId, logger, NUM_THREADS_PROPERTY, numThreads, PROP_NAME, ran, vertices |
| Constructor Summary | |
|---|---|
LabelPropagation(DLPAGraphBuilder builder,
WatchdogService wdog,
long nodeId,
Properties properties)
Constructs a new instance of the label propagation algorithm. |
|
| Method Summary | |
|---|---|
void |
disable()
Indicates that the affinity group finding system is disabled, so no new data should be collected (old can be disgarded). |
protected void |
doOtherInitialization()
Perform any algorithm specific initialization for an algorithm run. |
protected long |
doOtherNeighbors(LabelVertex vertex,
Map<Integer,Long> labelMap,
StringBuilder logSB)
Update the label map with any other neighbors known to a particular algorithm. |
void |
enable()
Indicates that the affinity group finding system is enabled, so new data should be collected again. |
Set<AffinityGroup> |
getAffinityGroups(long runNumber,
boolean done)
Returns the affinity groups found on this node. |
ConcurrentMap<Long,Map<Object,Long>> |
getNodeConflictMap()
Returns the node conflict map. |
ConcurrentMap<Identity,Map<Integer,Long>> |
getRemoteLabelMap()
Returns the remote label map. |
Map<Object,Map<Integer,List<Long>>> |
getRemoteLabels(Collection<Object> objIds)
Get the labels for all vertices in our affinity graph for identities that have used the given objects. |
void |
notifyCrossNodeEdges(Collection<Object> objIds,
long nodeId)
Indicates that the given node probably contains edges to the graph on the local node. |
void |
prepareAlgorithm(long runNumber)
A new run of the algorithm is about to start, so the client nodes should do whatever is necessary to set up for that run. |
void |
shutdown()
Indicates that the affinity group finding system is shutting down, and all local resources should be cleaned up. |
void |
startIteration(int iteration)
Start an iteration of the algorithm. |
| Methods inherited from class com.sun.sgs.impl.service.nodemap.affinity.AbstractLPA |
|---|
gatherGroups, initializeLPARun, setMostFrequentLabel |
| 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 |
|---|
static final String SERVER_HOST_PROPERTY
| Constructor Detail |
|---|
public LabelPropagation(DLPAGraphBuilder builder,
WatchdogService wdog,
long nodeId,
Properties properties)
throws Exception
builder - the graph producerwdog - the watchdog service, used for error reportingnodeId - 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 |
|---|
public Set<AffinityGroup> getAffinityGroups(long runNumber,
boolean done)
throws IOException
done set to true if it intends to start another algorithm
run at any time in the future, even if the current run fails.
getAffinityGroups in interface LPAClientrunNumber - the run number provided to the last
LPAClient.prepareAlgorithm(long) calldone - true if all iterations are done, allowing cleanup
IOException - if there is a communication problem
public void prepareAlgorithm(long runNumber)
throws IOException
LPAServer.readyToBegin(long, boolean) should be called.
Called by the LPAServer.
Asynchronously prepare ourselves for a run.
prepareAlgorithm in interface LPAClientrunNumber - the number of this algorithm run
IOException - if there is a communication problem
public void notifyCrossNodeEdges(Collection<Object> objIds,
long nodeId)
throws IOException
notifyCrossNodeEdges in interface LPAClientobjIds - the collection of objects, representing edges, that
probably have endpoints to vertices on this nodenodeId - the node with vertices attached to the edges
IOException - if there is a communication problem
public void startIteration(int iteration)
throws IOException
LPAServer.finishedIteration(long, boolean, boolean, int) should be called.
Called by the LPAServer.
This method is run asynchronously.
startIteration in interface LPAClientiteration - the iteration number
IOException - if there is a communication problem
public Map<Object,Map<Integer,List<Long>>> getRemoteLabels(Collection<Object> objIds)
throws IOException
getRemoteLabels in interface LPAClientobjIds - the collection of objects, representing potential graph
edges, that we want neighbor node information for
objIds) to
neighbor labels, with a count of each use
IOException - if there is a communication problempublic void enable()
enable in interface LPAClientpublic void disable()
disable in interface LPAClientpublic void shutdown()
shutdown in interface LPAClientprotected void doOtherInitialization()
Initialize our vertex conflicts. This needs to happen before we send our vertex conflict information to other nodes in response to an prepareAlgorithm call from the server, and before any notifyCrossNodeEdges calls.
doOtherInitialization in class AbstractLPA
protected long doOtherNeighbors(LabelVertex vertex,
Map<Integer,Long> labelMap,
StringBuilder logSB)
doOtherNeighbors in class AbstractLPAvertex - 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.public ConcurrentMap<Long,Map<Object,Long>> getNodeConflictMap()
public ConcurrentMap<Identity,Map<Integer,Long>> getRemoteLabelMap()
|
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 | |||||||||