Dear Simone,
I would probably do it as follows:
1. Import the CSV file as a data frame
2. Recode the "topic" column to use IDs like "t_696", "t_698", "t_717" and
so on.
3. Recode the "user" column to use IDs like "u_2", "u_9" and so on.
4. Use graph.data.frame to construct a graph.
5. Add a "type" vertex attribute to the constructed graph such that vertices
whose name starts with "t_" gets type 0, while the rest gets type 1. This
makes the graph bipartite to igraph.
Best,
Tamas
On 01/31/2013 11:32 AM, Simone Gabbriellini wrote:
> Dear List,
>
> I have a bunch of files where info about bipartite networks are coded this
> way:
>
> "topic","user","weight"
> 696,2,1
> 696,9,2
> 696,17,1
> 696,137,1
> 698,9,3
> 698,17,3
> 717,3,1
> 717,5,1
> 717,8,1
> 717,9,8
>
>
> is there any straightforward way to load one of this files and create
> a bipartite network with edge weights? Consider that there could be an
> overlap between numbers in the first and second column.
> Right now, I only have this code:
>
> net<-as.matrix(read.csv("my file"))
> g<-graph.edgelist(net[,-3])
>
> Any help much appreciated.
>
> Best,
> Simone
>
_______________________________________________
igraph-help mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/igraph-help