Hi there,

I am doing some network analysis working with k-cliques and over time I
want to see what nodes are members of what cliques and how big these
cliques are. I have managed to produce a matrix which shows which k-cliques
each node is part of over the 100 time periods (slow though) but I cannot
seem to calculate the size of each k-clique which is actually just a count.

Basically I have a dataframe like this with V1 being the node ID's and
V2-V4 showing which k-cliques the nodes are part of :




df <-
as.data.frame(cbind(c(1,2,3,4,5,6,7,8),c(1,1,1,1,2,2,2,2),c(0,0,0,2,0,0,0,0),c(0,0,0,0,0,0,0,0)))

# What I want is a dataframe like this where each k-clique value is
replaced by its size:

wanted <-
as.data.frame(cbind(c(1,2,3,4,5,6,7,8),c(4,4,4,4,5,5,5,5),c(0,0,0,5,0,0,0,0),c(0,0,0,0,0,0,0,0)))




It seems simple but I cannot get it working since these dataframes grow for
each time period and the k-cliques change. I have tried using a loop that
references to a table of the values but it does not work. I am sure there
is an easy way, however.



Hope to get some help,


Kind regards,


Frederik

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to