GitHub user SherlockYang opened a pull request:
https://github.com/apache/spark/pull/9150
[Spark-10994] Add local clustering coefficient computation in GraphX
The local clustering coefficient of a vertex (node) in a graph quantifies
how close its neighbours are to being a clique (complete graph).
More specifically, the local clustering coefficient C_i for a vertex v_i is
given by the proportion of links between the vertices within its neighbourhood
divided by the number of links that could possibly exist between them.
Duncan J. Watts and Steven Strogatz introduced the measure in 1998 to
determine whether a graph is a small-world network.
#### Usage
Here is a usage example for LocalClusteringCoefficient:
```Scala
import org.apache.spark.graphx._
import org.apache.spark._
val conf = new SparkConf().setAppName("testApp")
val sc = new SparkContext(conf)
// load a graph
val graph = GraphLoader.edgeListFile(sc,
"graph.txt").partitionBy(PartitionStrategy.RandomVertexCut)
// perform the local clustering coefficient computation
val LccCounter = graph.localClusteringCoefficient()
// output results for each vertex
val verts = LccCounter.vertices
verts.collect().foreach { case (vid, count) =>
println(vid + ": " + count)
}
```
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/SherlockYang/spark master
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/spark/pull/9150.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #9150
----
commit 20b56b79c630cd07e574cdf1bbc9b36225b7fcab
Author: SherlockYang72 <[email protected]>
Date: 2015-10-15T16:35:22Z
add local clustering coeffcient computation along with test suite
commit 83529d99740b22529c89d7bb8c5e082ab7706263
Author: SherlockYang72 <[email protected]>
Date: 2015-10-15T16:45:36Z
revise test suite
commit 169298df66932564a8505a8961ed34ad50fbe6ba
Author: SherlockYang72 <[email protected]>
Date: 2015-10-16T12:03:05Z
unit test
commit 97c705ed63ccb092724f54d5a63a382a93a88030
Author: SherlockYang72 <[email protected]>
Date: 2015-10-16T14:41:19Z
=
commit bd8d212ef8d9909a73ae074ff8a43b76d6c4f811
Author: SherlockYang72 <[email protected]>
Date: 2015-10-16T15:45:04Z
=
commit 18af17ceccf3b0d94e4f1a7c398cb36f15f1a6a1
Author: SherlockYang72 <[email protected]>
Date: 2015-10-16T16:21:35Z
=
commit a33789f74df41dfca2d6f8548e32fdb67ba6115b
Author: SherlockYang72 <[email protected]>
Date: 2015-10-16T16:31:49Z
=
commit 8e1a3560991e8fbce473ed37a65091ef0cbfb884
Author: SherlockYang72 <[email protected]>
Date: 2015-10-16T16:51:51Z
=
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]