igraph-help
[Top][All Lists]
Advanced

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

Re: [igraph] k-size groups in graph


From: Tamás Nepusz
Subject: Re: [igraph] k-size groups in graph
Date: Mon, 19 Mar 2012 19:41:18 +0100

> I need to enumerate all combinations of nodes in my graph (a very
> small one, 10 nodes maximum) for a value k that express the size of
> the configuration, like 2 for dyads, 3 for triads and so on until
> then no bigger order is possible, because there are only 4 nodes. Is
> further configuration exists… […]
> Is there something already made in igraph to accomplish this task?

You don't even need igraph for this; essentially you are looking for all the 
possible subsets of a given set (e.g., {A, B, C, D}). In R, this can be 
achieved by the sets package:

library(sets)
vs <- as.set(1:vcount(g) - 1)
2^vs

In Python, you can use the powerset() function that is to be found as an 
example in the documentation for the itertools module: 
http://docs.python.org/library/itertools.html#recipes

Best,
Tamas






reply via email to

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