GRASS GIS 7 Programmer's Manual  7.5.svn(2017)-r71933
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
centrality.c File Reference

Network Analysis library - centrality. More...

#include <stdio.h>
#include <stdlib.h>
#include <grass/gis.h>
#include <grass/vector.h>
#include <grass/glocale.h>
#include <grass/dgl/graph.h>
#include <grass/neta.h>
Include dependency graph for centrality.c:

Go to the source code of this file.

Functions

void NetA_degree_centrality (dglGraph_s *graph, double *degree)
 Computes degree centrality measure. More...
 
int NetA_eigenvector_centrality (dglGraph_s *graph, int iterations, double error, double *eigenvector)
 Computes eigenvector centrality using edge costs as weights. More...
 
int NetA_betweenness_closeness (dglGraph_s *graph, double *betweenness, double *closeness)
 Computes betweenness and closeness centrality measure using Brandes algorithm. More...
 

Detailed Description

Network Analysis library - centrality.

Centrality measures

(C) 2009-2010 by Daniel Bundala, and the GRASS Development Team

This program is free software under the GNU General Public License (>=v2). Read the file COPYING that comes with GRASS for details.

Author
Daniel Bundala (Google Summer of Code 2009)

Definition in file centrality.c.

Function Documentation

int NetA_betweenness_closeness ( dglGraph_s graph,
double *  betweenness,
double *  closeness 
)

Computes betweenness and closeness centrality measure using Brandes algorithm.

Edge costs must be nonnegative. If some edge costs are negative then the behaviour of this method is undefined.

Parameters
graphinput graph
[out]betweennessbetweeness values
[out]closenesscloneness values
Returns
0 on success
-1 on failure

Definition at line 126 of file centrality.c.

References _, count, dglEdgeGet_Cost(), dglEdgeGet_Tail(), dglEdgeset_T_First(), dglEdgeset_T_Initialize(), dglEdgeset_T_Next(), dglEdgeset_T_Release(), dglGet_NodeCount(), dglGetNode(), dglHeapExtractMin(), dglHeapFree(), dglHeapInit(), dglHeapInsertMin(), dglNode_T_First(), dglNode_T_Initialize(), dglNode_T_Next(), dglNode_T_Release(), dglNodeGet_Id(), dglNodeGet_OutEdgeset(), dst, G_fatal_error(), G_free(), G_percent(), G_percent_reset(), complex::i, _dglHeapNode::key, ilist::n_values, NULL, _dglHeapData::ul, _dglHeapNode::value, ilist::value, Vect_destroy_list(), Vect_list_append(), Vect_new_list(), and Vect_reset_list().

void NetA_degree_centrality ( dglGraph_s graph,
double *  degree 
)

Computes degree centrality measure.

Array degree has to be properly initialised to nnodes+1 elements

Parameters
graphinput graph
[out]degreearray of degrees

Definition at line 32 of file centrality.c.

References dglGet_NodeCount(), dglGetNode(), dglNodeGet_OutDegree(), and complex::i.

int NetA_eigenvector_centrality ( dglGraph_s graph,
int  iterations,
double  error,
double *  eigenvector 
)

Computes eigenvector centrality using edge costs as weights.

Parameters
graphinput graph
iterationsnumber of iterations
error?
[out]eigenvectoreigen vector value
Returns
0 on success
-1 on failure

Definition at line 54 of file centrality.c.

References _, dglEdgeGet_Cost(), dglEdgeGet_Tail(), dglEdgeset_T_First(), dglEdgeset_T_Initialize(), dglEdgeset_T_Next(), dglEdgeset_T_Release(), dglGet_NodeCount(), dglNode_T_First(), dglNode_T_Initialize(), dglNode_T_Next(), dglNode_T_Release(), dglNodeGet_Id(), dglNodeGet_OutEdgeset(), G_fatal_error(), G_free(), and complex::i.