igraph-help
[Top][All Lists]
Advanced

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

Re: [igraph] Writing Pajek and graphml files


From: Thomas Barnum
Subject: Re: [igraph] Writing Pajek and graphml files
Date: Mon, 25 Mar 2013 10:00:36 -0400

Hello Gabor,
Thank you for your reply. You are right about the graphml files having attributes set differently for R and gephi. When I look at the graphml file produced by R, the color of the edges are coded on a single line. For gephi, the file needs to have the information spread over three lines, one for R,G, and B respectively. Here is a link to their forum in case you are interested:

https://forum.gephi.org/viewtopic.php?t=1509&f=4

I changed 'name' to 'id' and now the vertex names import into gephi. The name of the color for the edges also exports in test.net, but is not recognized in gephi.
Thank you for the help,
Tom



On Sun, Mar 24, 2013 at 2:04 PM, Gábor Csárdi <address@hidden> wrote:
Hi,

On Sun, Mar 24, 2013 at 1:01 PM, Thomas Barnum <address@hidden> wrote:
Dear All,
I am trying to export a Pajek file and a graphml file to be opened in gephi. However, when I open the file in gephi, all the graph attributes (vertex names, vertex colors, and edge colors) are not recognized by gephi. I dropped the graphml file into Firefox and Firefox states that there does not appear to be style information associated with the file (for example, nodes are listed as 'n1' instead of by letters).

I am not sure why you expect Firefox to be able to interpret graphml files. It cannot do that.
 
Here is some workable code that reproduces the problem:

### I want to export two different colored edges in the final graph so this code uses two colors for the edges

foo<-graph.ring(10)
E(foo)$color[1:5]<-"blue"             
E(foo)$color[6:10]<-"green"
V(foo)$name <- LETTERS[1:10]

plot(foo, vertex.label=V(foo)$name)

write.graph(foo, format="pajek", file="test.net")

See ?read.graph for the attributes that are used in Pajek exports. (Referenced from ?write.graph.) The 'color' edge attribute is fine. Instead of 'name' use 'id', and that is saved.
 
write.graph(foo, format="graphml", file="test.graphml")

I can see all the attributes in the file. 

I guess the problem is, different programs set different attributes, so even if both can read and write graphml files, they just cannot interpret the attribute data. I understand that this is annoying, and something should be done about it.

As for your specific problem, I am not sure what attributes gephi interprets in graphml files, but maybe you can just check this in the gephi documentation and then make sure to use those.

I feel like I am missing something really obvious here, particularly in regards to the Pajek format, but I can't figure it out. I have tried including some attributes when I write the Pajek file. For example:

write.graph(foo, format="pajek", file="test.net", foo$color("blue","green"))

or

write.graph(foo, format="pajek", file="test.net", foo$c("blue","green"))

but I get this error message:

Error in write.graph.pajek(graph, file, ...) : attempt to apply non-function

I agree the error message is cryptic, but why do you think write.graph works this way? It does not, actually I am not even sure what foo$color("blue", "green") means, I guess it is a syntax error, because foo$color is NULL.

Gabor 


Any ideas/help/suggestions will be greatly appreciated.
All the best,
Tom

_______________________________________________
igraph-help mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/igraph-help




reply via email to

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