K - graph ID typeVV - vertex value typeEV - edge value typepublic class JaccardIndex<K extends org.apache.flink.types.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. |
org.apache.flink.api.java.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, rungetAlgorithmName, setParallelismpublic 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)
GraphAlgorithmWrappingBaseGraphAlgorithmWrappingBase.mergeConfiguration(org.apache.flink.graph.utils.proxy.GraphAlgorithmWrappingBase).canMergeConfigurationWith in class GraphAlgorithmWrappingBase<K extends org.apache.flink.types.CopyableValue<K>,VV,EV,org.apache.flink.api.java.DataSet<JaccardIndex.Result<K extends org.apache.flink.types.CopyableValue<K>>>>other - the algorithm with which to compare configurationGraphAlgorithmWrappingBase.mergeConfiguration(GraphAlgorithmWrappingBase)protected void mergeConfiguration(GraphAlgorithmWrappingBase other)
GraphAlgorithmWrappingBaseGraphAlgorithmWrappingBase.canMergeConfigurationWith(org.apache.flink.graph.utils.proxy.GraphAlgorithmWrappingBase) has checked that the configurations
can be merged.mergeConfiguration in class GraphAlgorithmWrappingBase<K extends org.apache.flink.types.CopyableValue<K>,VV,EV,org.apache.flink.api.java.DataSet<JaccardIndex.Result<K extends org.apache.flink.types.CopyableValue<K>>>>other - the algorithm from which to merge configurationGraphAlgorithmWrappingBase.canMergeConfigurationWith(GraphAlgorithmWrappingBase)public org.apache.flink.api.java.DataSet<JaccardIndex.Result<K>> runInternal(Graph<K,VV,EV> input) throws Exception
GraphAlgorithmWrappingDataSetGraphAlgorithm.run(Graph).runInternal in class GraphAlgorithmWrappingDataSet<K extends org.apache.flink.types.CopyableValue<K>,VV,EV,JaccardIndex.Result<K extends org.apache.flink.types.CopyableValue<K>>>input - the input graphExceptionCopyright © 2014–2019 The Apache Software Foundation. All rights reserved.