igraph-help
[Top][All Lists]
Advanced

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

Re: [igraph] New user ...


From: Tamas Nepusz
Subject: Re: [igraph] New user ...
Date: Tue, 13 Oct 2009 21:17:19 +0100

Hi Miguel and welcome to the igraph mailing list!

How do I use X and Y coordinates to define vertex of my network?
I'm not an expert in igraph's R interface, but there is at least one way to do it (this might not be the best, but I managed to figure this out):

g <- graph.empty(nrow(vertex))
V(g)$coox <- vertex[,1]
V(g)$cooy <- vertex[,2]

V(g) represents all the vertices of the graph; the above syntax can be used to assign attributes to the vertices. Similarly, E(g) represents all the edges.

Alternatively, you might consider using graph.data.frame() which requires two data frames; one for the edges and one for the vertices. The columns of the vertex data frame will automatically be assigned to the corresponding attributes in the graph. See ?graph.data.frame for more information.

--
Tamas





reply via email to

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