public class ConnectedComponents<K,VV extends Comparable<VV>,EV> extends Object implements GraphAlgorithm<K,VV,EV,DataSet<Vertex<K,VV>>>
This implementation uses a comparable vertex value as initial component identifier (ID). Vertices propagate their current value in each iteration. Upon receiving component IDs from its neighbors, a vertex adopts a new component ID if its value is lower than its current component ID.
The algorithm converges when vertices no longer update their component ID value or when the maximum number of iterations has been reached.
The result is a DataSet of vertices, where the vertex value corresponds to the assigned component ID.
GSAConnectedComponents
Modifier and Type | Class and Description |
---|---|
static class |
ConnectedComponents.CCMessenger<K,VV extends Comparable<VV>>
Sends the current vertex value to all adjacent vertices.
|
static class |
ConnectedComponents.CCUpdater<K,VV extends Comparable<VV>>
Updates the value of a vertex by picking the minimum neighbor value out of all the incoming messages.
|
Constructor and Description |
---|
ConnectedComponents(Integer maxIterations)
Creates an instance of the Connected Components algorithm.
|
public ConnectedComponents(Integer maxIterations)
maxIterations
- The maximum number of iterations to run.Copyright © 2014–2019 The Apache Software Foundation. All rights reserved.