Esempio n. 1
0
        /// <summary>
        /// Takes a network matrix and evaluates all possible cliques of size 'q', returning the INetworkMatrix
        /// representation of all cliques which are subnetworks of socialNetworkMatrix.
        /// </summary>
        /// <param name="socialNetworkMatrix">The social network to be searched.</param>
        /// <param name="sizeOfClique">The desired size of each clique.</param>
        /// <returns>The collection of INetworkMatrix instances which have at sizeOfClique members.</returns>
        public static IEnumerable<ICliqueMatrix> FindCliquesBySize(INetworkMatrix socialNetworkMatrix, int sizeOfClique)
        {
            var generator = new CombinationGenerator(socialNetworkMatrix.NodeCount, sizeOfClique);
            var pump = generator.CreateCombinationPump();

            foreach (var combo in pump)
            {
                var clique = NetworkMatrixFactory.CreateCliqueMatrix(combo, socialNetworkMatrix.NodeCount);

                if (socialNetworkMatrix.ContainsClique(clique))
                    yield return clique;
            }
        }
Esempio n. 2
0
        private static void TestComboGen()
        {
            var generator = new CombinationGenerator(MasterSetSize, SelectionCount);
            var i = 1;

            foreach (var combination in generator.CreateCombinationPump())
            {
                Console.WriteLine("Combination #{0}", i);
                i++;

                foreach (var number in combination)
                {
                    Console.Write("{0}   ", number);
                }

                Console.WriteLine(String.Empty);
            }
        }