K
- graph ID typeVV
- vertex value typeEV
- edge value typepublic class JaccardIndex<K extends CopyableValue<K>,VV,EV> extends GraphAlgorithmWrappingDataSet<K,VV,EV,JaccardIndex.Result<K>>
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 Jaccard Similarity 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 |
JaccardIndex.Result<T>
A result for the Jaccard Index algorithm.
|
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_GROUP_SIZE |
parallelism
Constructor and Description |
---|
JaccardIndex() |
Modifier and Type | Method and Description |
---|---|
protected boolean |
canMergeConfigurationWith(GraphAlgorithmWrappingBase other)
First test whether the algorithm configurations can be merged before the
call to
GraphAlgorithmWrappingBase.mergeConfiguration(org.apache.flink.graph.utils.proxy.GraphAlgorithmWrappingBase) . |
protected void |
mergeConfiguration(GraphAlgorithmWrappingBase other)
Merge the other configuration into this algorithm's after the call to
GraphAlgorithmWrappingBase.canMergeConfigurationWith(org.apache.flink.graph.utils.proxy.GraphAlgorithmWrappingBase) has checked that the configurations
can be merged. |
DataSet<JaccardIndex.Result<K>> |
runInternal(Graph<K,VV,EV> input)
The implementation of the algorithm, renamed from
GraphAlgorithm.run(Graph) . |
JaccardIndex<K,VV,EV> |
setGroupSize(int groupSize)
Override the default group size for the quadratic expansion of neighbor
pairs.
|
JaccardIndex<K,VV,EV> |
setMaximumScore(int numerator,
int denominator)
Filter out Jaccard Index scores greater than the given maximum fraction.
|
JaccardIndex<K,VV,EV> |
setMinimumScore(int numerator,
int denominator)
Filter out Jaccard Index scores less than the given minimum fraction.
|
JaccardIndex<K,VV,EV> |
setMirrorResults(boolean mirrorResults)
By default only one result is output for each pair of vertices.
|
equals, hashCode, run
getAlgorithmName, setParallelism
public static final int DEFAULT_GROUP_SIZE
public JaccardIndex<K,VV,EV> setGroupSize(int groupSize)
The default value should be near-optimal for all use cases.
groupSize
- the group size for the quadratic expansion of neighbor pairspublic JaccardIndex<K,VV,EV> setMinimumScore(int numerator, int denominator)
numerator
- numerator of the minimum scoredenominator
- denominator of the minimum scoresetMaximumScore(int, int)
public JaccardIndex<K,VV,EV> setMaximumScore(int numerator, int denominator)
numerator
- numerator of the maximum scoredenominator
- denominator of the maximum scoresetMinimumScore(int, int)
public JaccardIndex<K,VV,EV> setMirrorResults(boolean mirrorResults)
mirrorResults
- whether output results should be mirroredprotected boolean canMergeConfigurationWith(GraphAlgorithmWrappingBase other)
GraphAlgorithmWrappingBase
GraphAlgorithmWrappingBase.mergeConfiguration(org.apache.flink.graph.utils.proxy.GraphAlgorithmWrappingBase)
.canMergeConfigurationWith
in class GraphAlgorithmWrappingBase<K extends CopyableValue<K>,VV,EV,DataSet<JaccardIndex.Result<K extends CopyableValue<K>>>>
other
- the algorithm with which to compare configurationGraphAlgorithmWrappingBase.mergeConfiguration(GraphAlgorithmWrappingBase)
protected void mergeConfiguration(GraphAlgorithmWrappingBase other)
GraphAlgorithmWrappingBase
GraphAlgorithmWrappingBase.canMergeConfigurationWith(org.apache.flink.graph.utils.proxy.GraphAlgorithmWrappingBase)
has checked that the configurations
can be merged.mergeConfiguration
in class GraphAlgorithmWrappingBase<K extends CopyableValue<K>,VV,EV,DataSet<JaccardIndex.Result<K extends CopyableValue<K>>>>
other
- the algorithm from which to merge configurationGraphAlgorithmWrappingBase.canMergeConfigurationWith(GraphAlgorithmWrappingBase)
public DataSet<JaccardIndex.Result<K>> runInternal(Graph<K,VV,EV> input) throws Exception
GraphAlgorithmWrappingDataSet
GraphAlgorithm.run(Graph)
.runInternal
in class GraphAlgorithmWrappingDataSet<K extends CopyableValue<K>,VV,EV,JaccardIndex.Result<K extends CopyableValue<K>>>
input
- the input graphException
Copyright © 2014–2020 The Apache Software Foundation. All rights reserved.