Thanks for that. Here is the updated version:

#loop over the matrix#
for (b in seq(from=1, to=length(bl))){
for (i in seq(from=1, to=18)){
  for (j in seq(from=1, to=18)){
    if(i%in%bl[[b]] & j%in%bl[[b]] & cohesionmat[i,j] < co[b])
cohesionmat[i,j]<-co[b] else next
    }
  }
}

On Sat, Nov 15, 2014 at 2:00 PM, Gábor Csárdi <[email protected]>
wrote:

> Nice! Thanks for sharing!
>
> On Sat, Nov 15, 2014 at 1:17 PM, Richard Benton
> <[email protected]> wrote:
> [...]
> > #loop over the matrix#
> > for (b in seq(from=1, to=length(bl))){
> > for (i in seq(from=1, to=18)){
> >   for (j in seq(from=1, to=18)){
> >     if(i%in%bl[[b]] & j%in%bl[[b]]) cohesionmat[i,j]<-co[b] else next
>
> Here you also need to check that cohesionmat[i,j] is smaller than
> co[b]. It might happen that a block with smaller cohesion is listed
> later. (I am actually not completely sure, because I forgot how I
> implemented it, but it is better to be on the defensive side, anyway.)
>
> Gabor
>
> >     }
> >   }
> > }
> >
> > _______________________________________________
> > igraph-help mailing list
> > [email protected]
> > https://lists.nongnu.org/mailman/listinfo/igraph-help
> >
>
_______________________________________________
igraph-help mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/igraph-help

Reply via email to