コード例 #1
0
        public void DisposeTest()
        {
            // creates network nodes
            const int num     = 10;
            var       network = new Network();

            for (var i = 0u; i < num; i++)
            {
                network.AddVertex(i);
            }

            // creates edges
            for (var i = 0u; i < num; i++)
            {
                for (var j = i + 1; j < num; j++)
                {
                    network.AddEdge(new Connection(i, j));
                }
            }

            // creates and updates community algorithm
            var commAlgorithm = new CommunityAlgorithm(network);

            commAlgorithm.Update();

            // disposes algorithm
            commAlgorithm.Dispose();

            Assert.IsNull(commAlgorithm.Communities, "Community algorithm should not have any communities.");
            Assert.IsNull(commAlgorithm.NodesCommunities, "Community algorithm should not have any communities.");

            commAlgorithm.Dispose();
        }