Edge attributes on projected graph

Hello,
I would like to bring attributes that I have on the edges of a bipartite network (timestamps) into an attribute of the projected edge. More precisely I’m working with a bipartite network of online sharing so users A, B, C shared urls U1, U2 (A-> U1, B ->U1, C->U2) at various timestamps (t1, t2, t3). When I do the projection I would need to have an attribute to the new edge (A-B) that contains t1,t2.

I don’t think there’s a way to do it with the existing functions ( that might be something to consider for an expansion of bipartite.projection ) but I can’t even think of a good way to do this for large graphs.

Any idea?

There is no way to do this in igraph at the moment indeed, as you already suggest.

It is not exactly clear to me how you would like it to operate though. Is the idea that you list the attribute from all edges that are involved in the projection? Note that you do loose information about which URL was shared of course (and to which timestamp that corresponds). For example, if you have

A  U1  t1
A  U2  t2
B  U1  t1
B  U2  t3

you end up with a projection between A and B that uses all four edges, and so hence the list is [t1, t2, t1, t3]. It this what you have in mind?

If so it would then be easiest to implement an edge attribute combination for a bipartite projection (and your requirement then corresponds to the concat option). This needs to be implemented in the C core of igraph. If this is what you have in mind, it would be best to open an issue for it on GitHub with a feature request.

Hi,
thanks for your input. Yes what you describe is basically what I have in mind. In my specific case, I would love to be able to know when the sharing activity took place (this is to define temporal patterns between users). It’s a rather specific need and I’m not sure it’s worth an issue for it. Maybe I’ll first try to find a workaround in R and the I’ll see how it scales.

One way to do a bipartite projection is to merge the dataframe with itself and then do a groupby. If your dataset df would be this:

v   url   time
-------------- 
A   U1  t1
A   U2  t2
B   U1  t1
B   U2  t3

then you can do merge(df, df, by='url'). This gives you all pairs of nodes which shared the same URL (and at what time). You can them simply group by v.x and v.y, and concatenate the time column. I’m not an expert in R though, so perhaps someone else can help you out with that specific part.

1 Like