igraph-help
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[igraph] union.graph as reverse decompose.graph ?


From: Hermann Norpois
Subject: [igraph] union.graph as reverse decompose.graph ?
Date: Thu, 20 Aug 2015 13:59:15 +0200

Hello,

I would like to reverse the decompose.graph procedure. I guesse graph.union is the correct tool to do so. But I have some problems with the names of the attributes. I know it is documented ...

As union keeps the attributes of all graphs... "All graph, vertex and edge attributes are copied to the result. If an attribute is present in multiple graphs and would result a name clash, then this attribute is renamed by adding suffixes: _1, _2, etc." 

Actually, I am looking for a way to restore my original attributes.
Example:

Let netz be the original net and rnetz the reunified net ...
netz.dec <- decompose (netz)
rnetz <- graph.union (netz.dec)

# The attributes of the original net (netz)
list.edge.attributes (netz)
[1] "weight"
list.vertex.attributes (netz)
[1] "name" "x"    "y"  

# The attributes of the reunified net (rnetz)
list.edge.attributes (rnetz)
[1] "weight_1" "weight_2" "weight_3" "weight_4" "weight_5" "weight_6" "weight_7"
[8] "weight_8"
list.vertex.attributes (rnetz)
 [1] "x_1"  "x_2"  "x_3"  "x_4"  "x_5"  "x_6"  "x_7"  "x_8"  "y_1"  "y_2"
[11] "y_3"  "y_4"  "y_5"  "y_6"  "y_7"  "y_8"  "name"

How do I change the attributes of the reunified net (rnetz) to the attributes of the original net (netz)?

Thanks
Hermann

reply via email to

[Prev in Thread] Current Thread [Next in Thread]