I have very basic issue with igraph (in R): renaming of the node ids.
For example, I have following graph in form of edgelist.
10,12
10,14
12,14
12,15
14,15
12,17
17,34
17,100
100,34
I want to calculate local clustering coefficient for each node. First I have read the edgelist in object g using readcsv. Then, I used the following command to dump the local CC for each node.
write.csv(transitivity(g,type="local"),file="DumpLocalCC.csv")
Now the problem is, igraph changes the node IDs starting from 1 and I get following output
"","x"
"1",NA
"2",0.333333333333333
"3",0.333333333333333
"4",0.333333333333333
"5",1
"6",1
"7",1
Now how can I resolute which node id is what ? That is if 7 in the output file points to 100 or 34 ? Is there anyway, we can force igraph to dump actual nodeids like 10, 34, 100 etc and their respective Local CC ?
I was googling and found people suggested "V(g)$name <- as.character(V(g))" for preserving the nodeids. I tried however, I think I am not using it correctly. Also, since the data is large, I would not like to change the nodeids manually to make them sequential from 1 .... myself.
P.s: Here I noticed a similar question has been asked. It has been suggested to "assign these numbers as vertex names". How to do that ? Can someone exemplify it please ?
Another similar question like this (I understand its the similar question), where it was suggested to open an issue. I am not sure if this has been resolved ?
Thanks in advance.