[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[igraph] : Closeness

From: patricia
Subject: [igraph] : Closeness
Date: Sat, 25 Apr 2015 11:47:58 +0300

I need to calculate the closeness to all the vertices of a graph, but when you run the method below, an error message is displayed:

<< Cygwin_exception :: open_stackdumpfile ... >>

U could kindly tell me what the cause of the error.

.h File

class TNetData { 


igraph_t net;
MatrixXf date;
VectorXi classes;
float nSigma;
float nEpsilon;
int nK;
int NumberOfSamples;
int numberOfFeatures;
int numberOfClasses;
distanceName string;
Distances dist;


TNetData (string filename);
TNetData ~ ();

void KNN (float sigma, int K);
void wKNN (float sigma, int K);

void eCut (sigma float, float epsilon);
void weCut (sigma float, float epsilon);

void Post1NN (float sigma);
PostSupervised void ();

SaveSimulation void (int yes);
SaveNetwork void ();
void MatrixOfWeights (float sigma);
SaveNetMeasures void (int yes);

void SetDistance (string distance);
igraph_t GetNetwork * ();
// * MatrixXf GetData ();

igraph_vector_t Closeness (igraph_t * net, int numVertices);

#endif / * NETDATA_H_ * /

Cpp file

igraph_vector_t TNetData :: Closeness (igraph_t * net, int numVertices) {

    igraph_vector_t result_Closeness;
    igraph_vector_t id_Vertices;
    igraph_vs_t vs;
    // Igraph_vit_t it;
    igraph_integer_t i, position, id;

    igraph_vector_init (& id_Vertices, numVertices);
    igraph_vector_null (& id_Vertices);

    igraph_vs_all (& vs);

    // Igraph_vit_create (net, vs, & it);

    igraph_closeness (net, & result_Closeness, vs, IGRAPH_ALL, 0.0);

    for (i = 0; i <igraph_vector_size (& id_Vertices); i ++) {
        position = igraph_vector_which_max (& result_Closeness);
        igraph_vector_set (& result_Closeness, position, 0.0);
        id = VAN (net, "index" position);
        igraph_vector_set (& id_Vertices, i, id);

    igraph_vector_destroy (& result_Closeness);
    igraph_vs_destroy (& vs);
    // Igraph_vit_destroy (& it);

    return (id_Vertices);

igraph_t *TNetData::GetNetwork(){
return & net;

Main Program

id_Vertices = network-> Closeness (network-> GetNetwork (), numVertices);

Thank you

reply via email to

[Prev in Thread] Current Thread [Next in Thread]