I have weighted two graphs (`G`

, and `G_random`

), the one is a copy of the other. After using `igraph_rewire`

on my `G_random`

, I noticed the edge attributes do not carry over (perhaps that can be added to the documentation), and I would like to reassign them (randomly is fine). However,

some of the functions in Chapter 12. Graph, Vertex and Edge Attributes are documented very confusingly. For example `igraph_cattribute_EAN_setv`

has the following:

2.2.25.

`igraph_cattribute_EAN_setv`

— Set a numeric edge attribute for all vertices.

`int igraph_cattribute_EAN_setv(igraph_t *graph, const char *name, const igraph_vector_t *v);`

The attribute will be added if not present yet.

Arguments:

:`graph`

The graph. :`name`

Name of the attribute. :`v`

The new attribute values. The length of this vector must match the number of edges.

I think it assigns the values in `v`

one-to-one to * edges* in

`G`

(or at least that is the function I am looking for), but given the reference to vertices, I am a bit confused. I would just like confirmation that the following makes sense:Excerpt of C++ code:

```
// turn on attribute handling for igraph to handle edge weights
igraph_i_set_attribute_table(&igraph_cattribute_table);
igraph_t G;
read_graph(infile, G, IGRAPH_ADD_WEIGHTS_YES); // function that reads in a weighted graph
// make copy of G
igraph_t G_random;
igraph_copy(&G_random, &G);
// rewire the copy
igraph_rewire(&G_random, 3*E, IGRAPH_REWIRING_SIMPLE);
// fetch edge weights from original graph
igraph_vector_t edge_weights;
igraph_vector_init(&edge_weights, E);
igraph_cattribute_EANV(&G, "weight", igraph_ess_all(IGRAPH_EDGEORDER_ID), &edge_weights);
// assign them to edges in the graph copy
igraph_cattribute_EAN_setv(&G_random, "weight", &edge_weights);
// clean up
igraph_vector_destroy(&edge_weights);
```