igraph-help
[Top][All Lists]
Advanced

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

Re: [igraph] number of nodes


From: Roberto Pagliari
Subject: Re: [igraph] number of nodes
Date: Wed, 25 Nov 2009 12:37:45 -0800

I have a last question about clustering. I can't get the code to work, I always get "Assertion failed: (v->stor_begin != NULL), function igraph_vector_bool_size, file vector.pmt, line 449.
Abort trap"

The code is this


#include <iostream.h>
#include <stdio.h>
#include <stdlib.h>
#include <igraph.h>


int main(void) {
igraph_t graph;
FILE *myfile;
igraph_vector_t membership;
igraph_vector_t weights;
igraph_vector_t initial;
igraph_vector_bool_t fixed;
igraph_integer_t num_nodes, num_edges;

myfile = fopen("europe.gml", "r");
igraph_read_graph_gml(&graph, myfile);
fclose(myfile);
num_nodes = igraph_vcount(&graph);
igraph_vector_init(&membership, num_nodes);
num_edges = igraph_ecount(&graph);
igraph_vector_init(&weights, num_edges);
  for(int i=0; i<igraph_vector_size(&weights); i++) 
{
VECTOR(weights)[i] = 1;
/* VECTOR(initial)[i] = i;
VECTOR(fixed)[i] = 0;*/
  }
igraph_community_label_propagation(&graph, &membership, &weights, &initial, &fixed);
cout << "Number of nodes: " << num_nodes << "\n Number of edges: " << num_edges << "\n";
igraph_vector_destroy(&membership);
igraph_vector_destroy(&weights);
igraph_destroy(&graph);
return 0;
}



On Wed, Nov 25, 2009 at 12:19 PM, Roberto Pagliari <address@hidden> wrote:
for some reasons if I declare graph as igraph_t graph and use &graph, it works


On Wed, Nov 25, 2009 at 12:17 PM, Roberto Pagliari <address@hidden> wrote:
the code I used is this


int main(void) {
igraph_t *graph;
FILE *myfile;
igraph_vector_t *membership;
igraph_vector_t *weights;
igraph_vector_t *initial;
igraph_vector_bool_t *fixed;
int num_nodes;

myfile = fopen("europe.gml", "r");
igraph_read_graph_gml(graph, myfile);
num_nodes = igraph_vcount(graph);
// printf("number of nodes: %f\n", igraph_vcount(graph));
// igraph_community_label_propagation(graph, )
fclose(myfile);
return 0;
}



reply via email to

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