K
- graph ID typeVV
- vertex value typeEV
- edge value typepublic class AdamicAdar<K extends CopyableValue<K>,VV,EV> extends GraphAlgorithmWrappingDataSet<K,VV,EV,AdamicAdar.Result<K>>
Adamic-Adar measures the similarity between pairs of vertices as the sum of the inverse logarithm of degree over shared neighbors. Scores are non-negative and unbounded. A vertex with higher degree has greater overall influence but is less influential to each pair of neighbors.
This implementation produces similarity scores for each pair of vertices in the graph with at least one shared neighbor; equivalently, this is the set of all non-zero Adamic-Adar coefficients.
The input graph must be a simple, undirected graph containing no duplicate edges or self-loops.
Modifier and Type | Class and Description |
---|---|
static class |
AdamicAdar.Result<T>
Wraps
Tuple3 to encapsulate results from the Adamic-Adar algorithm. |
Constructor and Description |
---|
AdamicAdar() |
Modifier and Type | Method and Description |
---|---|
protected String |
getAlgorithmName()
Algorithms are identified by name rather than by class to allow subclassing.
|
protected boolean |
mergeConfiguration(GraphAlgorithmWrappingDataSet other)
An algorithm must first test whether the configurations can be merged
before merging individual fields.
|
DataSet<AdamicAdar.Result<K>> |
runInternal(Graph<K,VV,EV> input)
The implementation of the algorithm, renamed from
GraphAlgorithm.run(Graph) . |
AdamicAdar<K,VV,EV> |
setLittleParallelism(int littleParallelism)
Override the parallelism of operators processing small amounts of data.
|
AdamicAdar<K,VV,EV> |
setMinimumRatio(float ratio)
Filter out Adamic-Adar scores less than the given ratio times the average score.
|
AdamicAdar<K,VV,EV> |
setMinimumScore(float score)
Filter out Adamic-Adar scores less than the given minimum.
|
equals, hashCode, run
public AdamicAdar<K,VV,EV> setMinimumScore(float score)
score
- minimum scorepublic AdamicAdar<K,VV,EV> setMinimumRatio(float ratio)
ratio
- minimum ratiopublic AdamicAdar<K,VV,EV> setLittleParallelism(int littleParallelism)
littleParallelism
- operator parallelismprotected String getAlgorithmName()
GraphAlgorithmWrappingDataSet
getAlgorithmName
in class GraphAlgorithmWrappingDataSet<K extends CopyableValue<K>,VV,EV,AdamicAdar.Result<K extends CopyableValue<K>>>
protected boolean mergeConfiguration(GraphAlgorithmWrappingDataSet other)
GraphAlgorithmWrappingDataSet
mergeConfiguration
in class GraphAlgorithmWrappingDataSet<K extends CopyableValue<K>,VV,EV,AdamicAdar.Result<K extends CopyableValue<K>>>
other
- the algorithm with which to compare and mergepublic DataSet<AdamicAdar.Result<K>> runInternal(Graph<K,VV,EV> input) throws Exception
GraphAlgorithmWrappingDataSet
GraphAlgorithm.run(Graph)
.runInternal
in class GraphAlgorithmWrappingDataSet<K extends CopyableValue<K>,VV,EV,AdamicAdar.Result<K extends CopyableValue<K>>>
input
- the input graphException
Copyright © 2014–2018 The Apache Software Foundation. All rights reserved.