Пример #1
0
        public virtual void Cycles_K4()
        {
            InitialCycles initial = new InitialCycles(K4);

            // todo replace with hasSize (hamcrest)
            Assert.AreEqual(4, initial.GetCycles().Count());
            Assert.AreEqual(4, initial.GetCyclesOfLength(3).Count());
        }
Пример #2
0
        /// <summary>
        /// Generate the relevant cycle basis from a precomputed set of initial
        /// cycles.
        /// </summary>
        /// <param name="initial">set of initial cycles.</param>
        /// <exception cref="System.ArgumentNullException">null InitialCycles provided</exception>
        internal RelevantCycles(InitialCycles initial)
        {
            CheckNotNull(initial, nameof(initial), "No InitialCycles provided");

            this.basis = new GreedyBasis(initial.GetNumberOfCycles(), initial.GetNumberOfEdges());

            // processing by size add cycles which are independent of smaller cycles
            foreach (var length in initial.Lengths)
            {
                basis.AddAll(Independent(initial.GetCyclesOfLength(length)));
            }
        }