File: igraph_attribute_combination.c

package info (click to toggle)
igraph 0.10.2%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 16,176 kB
  • sloc: ansic: 121,500; cpp: 21,699; xml: 2,734; python: 411; makefile: 147; javascript: 20; sh: 9
file content (29 lines) | stat: -rw-r--r-- 894 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include <igraph.h>

int main(void) {
    igraph_t graph;

    igraph_attribute_combination_t comb;

    igraph_set_attribute_table(&igraph_cattribute_table);

    igraph_small(&graph, 2, IGRAPH_DIRECTED,
                 0,1, 0,1,
                 -1);

    SETEAB(&graph, "type", 0, true);
    SETEAB(&graph, "type", 1, false);

    igraph_attribute_combination(&comb,
                                 "weight", IGRAPH_ATTRIBUTE_COMBINE_SUM,
                                 "type",   IGRAPH_ATTRIBUTE_COMBINE_FIRST,
                                 "",       IGRAPH_ATTRIBUTE_COMBINE_IGNORE,
                                 IGRAPH_NO_MORE_ATTRIBUTES);
    igraph_simplify(&graph, /*multiple=*/ true, /*loops=*/ true, &comb);
    igraph_write_graph_graphml(&graph, stdout, /*prefixattr=*/ true);

    igraph_destroy(&graph);
    igraph_attribute_combination_destroy(&comb);

    return 0;
}