# Graph Closeness

Graph Closeness is used to compute the Closeness metric of a node in a graph, which is a metric related to the node centrality.

This is a part of a series of custom modules based on the CRAN igraph package.
Graph Closeness is used to compute the Closeness metric of a node in a graph, which is a metric related to the node centrality.
The left input port is the graph dataset and needs to be represented in two columns as a list of edges where each value in each column represents a Node Id and each row represents an Edge, as shown here.
![enter image description here][1]
The right input port for the module is optional and represents edge weights, which when used needs to be a single column dataset as shown here.
![enter image description here][2]
Here is an example showing how to use this custom component.
![enter image description here][3]
In this example, weighted_network.csv was generated using available code as described in “Lancichinetti, Andrea, Santo Fortunato, and Filippo Radicchi: Benchmark graphs for testing community detection algorithms. Physical Review E 78.4 (2008): 046110”. An edge weight column was added to the dataset.
This is what the output of the module looks like for this graph. Here the output was generated with the results normalized and sorted.
![enter image description here][4]
For directed graphs, both In-node Closeness and Out-node Closeness are computed, as shown below. Here the computed values are the same because the graph is undirected and the option “Directed Graph” in the module properties was selected only to demonstrated this possibility.
![enter image description here][5]
[1]: https://alvilcek.blob.core.windows.net/azuremlcustommodules/Azure%20ML%20Custom%20Modules/documentation/Graph_Closeness_1.PNG
[2]: https://alvilcek.blob.core.windows.net/azuremlcustommodules/Azure%20ML%20Custom%20Modules/documentation/Graph_Closeness_2.PNG
[3]: https://alvilcek.blob.core.windows.net/azuremlcustommodules/Azure%20ML%20Custom%20Modules/documentation/Graph_Closeness_3.PNG
[4]: https://alvilcek.blob.core.windows.net/azuremlcustommodules/Azure%20ML%20Custom%20Modules/documentation/Graph_Closeness_4.PNG
[5]: https://alvilcek.blob.core.windows.net/azuremlcustommodules/Azure%20ML%20Custom%20Modules/documentation/Graph_Closeness_5.PNG