igraph-help
[Top][All Lists]
Advanced

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

[igraph] seeking example usage of igraph_simplify for C


From: Scheibmeir, John
Subject: [igraph] seeking example usage of igraph_simplify for C
Date: Wed, 27 Mar 2013 02:19:43 +0000

Could someone please provide an example of igraph_simplify where the weights of 
the edges are saved as an attribute to the modified graph's edges?

I've read the documentation but I don't understand the edge_comb parameter:

int igraph_simplify(igraph_t *graph, igraph_bool_t multiple, 
                    igraph_bool_t loops, 
                    const igraph_attribute_combination_t *edge_comb);

This is the code I presently have which does not seem to save the weights as an 
attribute:

void simplify_graph(igraph_t *g) {
        printf("==== SIMPLIFY ====\n");
        igraph_attribute_combination_t comb;
        igraph_attribute_combination_init(&comb);
        
igraph_attribute_combination_add(&comb,"weight",IGRAPH_ATTRIBUTE_COMBINE_SUM,&igraph_i_attribute_combine_edges);
        igraph_simplify(g,1,0,&comb);
        igraph_attribute_combination_destroy(&comb);
}

Ideally, I would run simplify_graph and afterwards each edge would have an 
attribute named weight which would be the edge frequency for two given vertexes.

With the code above, the graph is simplified but I have no attribute.

Thanks - john

John S




reply via email to

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