Reading graphs along with edge attributes with the C library

Has anyone experienced reading graphs together with attributes (e.g. edge weights) stored in graphml files with the C library? It seems ‘igraph_read_graph_graphml’ just ignores attributes. BTW, does the C library allow one to get the weighted adjacent matrix from a weighted graph (it seems ‘igraph_get_adjacency’ does not enable this)?

I have tried none of this, but:

  • I believe you need to set up the C attribute handler first, see igraph Reference Manual
  • I think you will need to write your own function to convert to a weighted adjacency matrix. Take a look at EANV to get edge attributes, and get_edgelist to get a vector with pairs of edge endpoints. Handling graphs with multi-edges is up to you. Use has_multiple to detect such graphs.
1 Like