[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [igraph] Network prunning (triplets)
From: |
Gábor Csárdi |
Subject: |
Re: [igraph] Network prunning (triplets) |
Date: |
Mon, 30 May 2011 09:12:04 -0400 |
Hi,
g <- graph.data.frame(data.frame(from=c('A','B','C','D','E'),
to=c('C','A','B','B','A'),
weight=c(1,5,3,5,10)), directed=F)
cl <- cliques(g, min=3, max=3)
edges <- lapply(cl, function(x) E(g, path=c(x,x[1])))
clw <- lapply(edges, function(x) E(g)[x]$weight)
'edges' will contain the edges of each triangle in the network, and
'clw' will contain their weights, in the same order. Then you can
select the edge with the smallest weight, in each triangle, or
globally, as you like; and delete them with 'delete.vertices'.
Best,
Gabor
On Mon, May 23, 2011 at 8:49 AM, address@hidden
<address@hidden> wrote:
> Hi,
>
> I am trying to find out how to do network pruning.
>
> Lets say we have example network
>
> g =
> graph.data.frame(data.frame(cbind(c('A','B','C','D','E'),c('C','A','B','B','A'),c(1,5,3,5,10))),directed=F)
> E(g)$label = c(1,5,3,5,10)
>
> I want to find triplets connected together in that network.
> I guess this is
>
> cliques(g,min=3,max=3)
>
> The goal is to find all triplets and remove edge with lowest value.
>
> Does anyone know how to do it ?
>
> Kind regards,
> Mateusz
>
>
> _______________________________________________
> igraph-help mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/igraph-help
>
>
--
Gabor Csardi <address@hidden> MTA KFKI RMKI