Skip to content

Commit

Permalink
Adding documentation for freemans centrality, spliting measures into …
Browse files Browse the repository at this point in the history
…vertex and graph
  • Loading branch information
riomus committed Apr 14, 2016
1 parent 59df22b commit 0808e71
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 11 deletions.
30 changes: 30 additions & 0 deletions freeman.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
Freeman's network centrality
=====================

Freeman's centrality tells us how heterogenous is degree centrality ammong vertices of network. For start network, we will get a value 1.

:math:`FC(g)=\frac{\sum_{x \in g}{N_{max}-|N(x)|}}{(|g|-1)*(|g|-2)}`

Where ``g`` is given graph, ``N(x)`` returns set of neighbours of vertex ``x``, ``|g|`` is number of vertices in graph ``g`` and :math:`N_{max}` is maximal degree that can be observed in network.

For further informations please refere to [Freeman]_.

.. code-block:: scala
import ml.sparkling.graph.operators.OperatorsDSL._
import org.apache.spark.SparkContext
import org.apache.spark.graphx.Graph
implicit ctx:SparkContext=???
// initialize your SparkContext as implicit value
val graph =???
// load your graph (for example using Graph loading API)
val freemanCentrality: Double= graph.freemanCentrality()
// Freeman centrality value for graph
References:

.. [Freeman] Freeman, L. C. (1978). Centrality in social networks conceptual clarification. Social networks, 1(3), 215-239., `PDF <http://leonidzhukov.ru/hse/2013/socialnetworks/papers/freeman79-centrality.pdf>`_
43 changes: 32 additions & 11 deletions measures.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,17 @@ Using SparklingGraph you can utilize multiple well-known measures for graphs.
Graph measures API
------------------

Each mesure extends `VertexMeasure <http://sparkling-graph.github.io/sparkling-graph/latest/api/#ml.sparkling.graph.api.operators.measures.VertexMeasure>`_ trait, defining what kind of value will be returned for each vertex. For main part of measures that will be a single number (like Double) but for some of them a tupple can be returned (like (Double,Double)). Each measure defines also implicit methods for graph, thanks to what your code will be more readable, and you will develop your experiments faster.

Graph measures
+++++++++++++++++

Each graph mesure extends `GraphMeasure <http://sparkling-graph.github.io/sparkling-graph/latest/api/#ml.sparkling.graph.api.operators.measures.GraphMeasure>`_ trait, defining what kind of value will be returned for whole graph.


Vertex measures
+++++++++++++++++

Each vertex mesure extends `VertexMeasure <http://sparkling-graph.github.io/sparkling-graph/latest/api/#ml.sparkling.graph.api.operators.measures.VertexMeasure>`_ trait, defining what kind of value will be returned for each vertex. For main part of measures that will be a single number (like Double) but for some of them a tupple can be returned (like (Double,Double)). Each measure defines also implicit methods for graph, thanks to what your code will be more readable, and you will develop your experiments faster.

Measures accepts `VertexMeasureConfiguration <http://sparkling-graph.github.io/sparkling-graph/latest/api/#ml.sparkling.graph.api.operators.measures.VertexMeasureConfiguration>`_ in order to configure computation process. You can set following parameters:

Expand All @@ -21,13 +31,24 @@ Measures

Curretnly you can use following measures:

.. toctree::
:maxdepth: 2

closeness
eigenvector
hits
degree
neighborhoodConnectivity
vertexEmbeddedness
localClustering

* Vertex measures:

.. toctree::
:maxdepth: 2

closeness
eigenvector
hits
degree
neighborhoodConnectivity
vertexEmbeddedness
localClustering


* Graph measures:

.. toctree::
:maxdepth: 2

freeman

0 comments on commit 0808e71

Please sign in to comment.