[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [igraph] question about edge weights
From: |
Tamás Nepusz |
Subject: |
Re: [igraph] question about edge weights |
Date: |
Mon, 16 Jul 2012 20:27:32 +0200 |
Hello Jessie,
How are the nodes and edges defined in your graph and what is their relation to
the data frame?
--
T.
On Monday, 16 July 2012 at 19:51, Jessie Gunter wrote:
> Hello,
>
> I am using igraph to reshape a dataframe and create a graph with weighted
> edges between nodes. I melted the dataframe and used this...
>
> > E23_new<-data.frame(id=E23[,1],var=E23.contacts,value=E23.recode)
>
> to make the dataset look like this:
>
> > head(E23_new)
> id var value
> 1 23002 Chief 4
> 2 23003 Chief 4
> 3 23004 Chief 3
> 4 23005 Chief 3
> 5 23006 Chief 3
> 6 23007 Chief 2
>
> I am trying to make the "value" column the edge weights. I had no luck with
> this:
>
> g <- set.edge.attribute(g, "weight", value=E23.recode)
>
> How can I weight the edges according to the number in the value column? Right
> now they are all weighted 1.0.
>
> Any help would be greatly appreciated. Thanks in advance.
>
> -Jessie
> _______________________________________________
> igraph-help mailing list
> address@hidden (mailto:address@hidden)
> https://lists.nongnu.org/mailman/listinfo/igraph-help
>