0

I have been trying to combine the subgraphs preserving the original edge attributes using graph.union function in igraph. Operation was successful but the new graph forgot its edge attributes. I have even tried the options mentioned here but it seems to me that there are some bugs.

In my work, I have used two column data as edgelist separated by tab (as delimiter).

The method I have:

tab118_FP2_9<-read.table("D:/edgelist_118.9.out", header = FALSE, sep = "\t" ,"r")
tab118_FP2_9a<-tab118_FP2_9+1 # have used python script , in which counting starts from zero , which is actually the no. one in reality
g118_FP2_9<-graph.data.frame(tab118_FP2_9a, directed =F)
tab118_FP2_3<-read.table("D:/edgelist_118.3.out", header = FALSE, sep = "\t" ,"r")
tab118_FP2_3a<-tab118_FP2_3+1 # have used python script , in which counting starts from zero , which is actually the no. one in reality
g118_FP2_3<-graph.data.frame(tab118_FP2_3a, directed =F)
g118_FP2_3<-graph.data.frame(tab118_FP2_3a, directed=F)
g118_FP2_9<-graph.data.frame(tab118_FP2_9a, directed=F)
E(g118_FP2_9)$weight<- 2
E(g118_FP2_3)$weight<- 1
E(g118_FP2_3)$color<-"red"
E(g118_FP2_9)$color<-"blue"
g118_FP2_3_9<-g118_FP2_3 %u% g118_FP2_9

Fortunately graphs got merged successfully but the original edge attributes (color and weight) is lost.

How can I send my input files?

I want to retain the edge colors of the original graphs as it is in the merged new graph.

Anthon
  • 69,918
  • 32
  • 186
  • 246
gp771
  • 1
  • 4
  • The mailing list post you cite is old, and does not apply any more. `graph.union` keeps edge attributes now. (It renames them, though when they are present in both graphs.) See http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example on how to include data. – Gabor Csardi Apr 15 '15 at 19:41
  • Thanks Gabor I will have a look at it – gp771 Apr 16 '15 at 08:18
  • Gabor I tried the suggestions http://stackoverflow.com/questions/29650007/how-to-combine-the-subgraphs-retaining-the-edge-attributes , undoubtedly merging was successful but the color attributes of the edge changed could you please help me out. – gp771 Apr 16 '15 at 16:57
  • I am not sure what the problem is, sorry. – Gabor Csardi Apr 16 '15 at 17:10
  • Hi Gabor I got one of the links http://stackoverflow.com/questions/26896087/union-of-igraph-objects-loses-attributes/26896945#26896945 which solved my problem. Now I am able to recall the hidden edge colors back to the merged graph. Thanks anyways – gp771 Apr 17 '15 at 04:18

0 Answers0