How to restore attribute after union n igraphs?
let's say I have n igraphs objects g1 , g2 ,.., gn . They are undirected and weighted graphs, i.e. new weight's attribute should be added. I'd like to union n graphs into the weighted graph g . It is known from the documentation (see ?graph.union ) if the n graphs have the weight attribute, it is renamed by adding a _1 and _2 (and _3 , etc.) suffix, i.e. weight_1 , weight_2 ,..., weight_n . I have seen the answer and wrote the code for n=3 graphs (see below). Edited: library(igraph) rm(list=ls(all=TRUE)) # delete all objects g1 <- graph_from_literal(A1-B1-C1) g2 <- graph_from_literal(A2-B2-C2)