GRASS Programmer's Manual  6.5.svn(2014)-r66266
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
centrality.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <grass/gis.h>
#include <grass/Vect.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...
 

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(), G_fatal_error(), G_free(), G_percent(), G_percent_reset(), _dglHeapNode::key, NULL, dialogs::s, _dglHeapData::ul, _dglHeapNode::value, Vect_destroy_list(), Vect_list_append(), Vect_new_list(), Vect_reset_list(), and dialogs::w.

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]arrayof degrees

Definition at line 32 of file centrality.c.

References dglGet_NodeCount(), dglGetNode(), and dglNodeGet_OutDegree().

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