igraph-help
[Top][All Lists]
Advanced

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

Re: [igraph] edge weights bipartite projection


From: Gábor Csárdi
Subject: Re: [igraph] edge weights bipartite projection
Date: Fri, 19 Oct 2012 10:26:09 -0400

Moses,

this is not very hard, you just calculate all shortest paths between
A-vertices and keep the ones that are of length two. E.g.

library(igraph)
inc <- matrix(sample(0:1, 50, replace=TRUE), 10, 5)
g <- graph.incidence(inc)

all3Paths <- sapply(which(V(g)$type), function(from) {
  sp <- get.all.shortest.paths(graph=g, from=from, to=which(V(g)$type))$res
  sp[ sapply(sp, length) == 3 ]
})
unlist(all3Paths, recursive=FALSE)

Gabor

On Fri, Oct 19, 2012 at 9:44 AM, Moses Boudourides
<address@hidden> wrote:
> Gábor,
>
> Let me ask something which is irrelevant to this thread and I won't be
> surprised if you tell me that it is already taken care in igraph (in
> which case I'll be grateful if you could tell me exactly how - because
> I'm extremely lazy when I come to searching into manuals). This is
> what I would like to know:
>
> When projecting a bipartite graph, is it possible instead of taking
> the number of 2-paths between two vertices to get explicitly the set
> of all such 2-paths? Of course, this amounts to getting a list of
> vertices of mode B establishing the 2-paths for any pair of vertices
> of mode A.
>
> --Moses
>
> On Fri, Oct 19, 2012 at 4:30 PM, Gábor Csárdi <address@hidden> wrote:
>> On Fri, Oct 19, 2012 at 8:36 AM, Florian Umlauf (CRIE)
>> <address@hidden> wrote:
>> [...]
>>> I am working with a bipartite weighted network.  So every edge has a weight.
>>> When I use the bipartite.projection() the old weights gets lost and the
>>> bipartite.projection() return a weight where it sums up the number of
>>> alternative connections.
>>
>> That is the default behavior, but you can customize it, see
>> ?attribute.combination for details.
>>
>>> Is there a way to hold the old weights and sum them up for the projection?
>>
>> I am not sure what you mean by this. Isn't this what is happening now
>> by default? Can you give a small example for what you want?
>>
>> Thanks,
>> Gabor
>>
>>> Thank everyone for your help
>>>
>>> Florian
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> igraph-help mailing list
>>> address@hidden
>>> https://lists.nongnu.org/mailman/listinfo/igraph-help
>>>
>>
>>
>>
>> --
>> Gabor Csardi <address@hidden>     MTA KFKI RMKI
>>
>> _______________________________________________
>> igraph-help mailing list
>> address@hidden
>> https://lists.nongnu.org/mailman/listinfo/igraph-help
>
> _______________________________________________
> igraph-help mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/igraph-help



-- 
Gabor Csardi <address@hidden>     MTA KFKI RMKI



reply via email to

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