GRASS GIS 8 Programmer's Manual  8.5.0dev(2024)-36359e2344
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

◆ NetA_betweenness_closeness()

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]betweennessbetweenness values
[out]closenesscloneness values
Returns
0 on success
-1 on failure

Definition at line 125 of file centrality.c.

References _, count, dglGet_NodeCount(), dglNode_T_First(), dglNode_T_Initialize(), dglNode_T_Next(), dst, G_calloc, G_fatal_error(), G_percent(), G_percent_reset(), and Vect_new_list().

◆ NetA_degree_centrality()

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(), and dglNodeGet_OutDegree().

◆ NetA_eigenvector_centrality()

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.