igraph-help
[Top][All Lists]
Advanced

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

Re: [igraph] A very elementary question


From: Moses Boudourides
Subject: Re: [igraph] A very elementary question
Date: Sat, 8 Jan 2011 23:12:52 +0100

OK, I've done it and realized that it was so trivial.. Sorry for the
nuisance. Thanks again, --Moses

On Sat, Jan 8, 2011 at 10:29 PM, Tamás Nepusz <address@hidden> wrote:
> Let's generate a random graph using preferential attachment as an example:
>
> library(igraph)
> g <- barabasi.game(25, m=2)
>
> Let's add some weights just for the sake of our example:
>
> E(g)$weight <- seq(1, ecount(g))
>
> Also, let's add some node labels:
>
> V(g)$label <- LETTERS[1:vcount(g)]
>
> Now, we have to assign the edge weights as the "label" attribute to the edges:
>
> E(g)$label <- E(g)$weight
>
> Finally, we can plot the graph:
>
> plot(g)
>
> It's no different if you imported your graph from Pajek; use 
> list.vertex.attributes() and list.edge.attributes() to find the names of your 
> vertex/edge attributes and decide which one should be assigned to the "label" 
> attributes of the vertices/edges. If you want to vary the edge width instead 
> of using edge labels, assign a numeric vector to the "weight" attribute of 
> the edges (i.e. E(g)$weight).
>
> --
> T.
>
>
> _______________________________________________
> igraph-help mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/igraph-help
>



reply via email to

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