public double ComputeRWithAddedNode(Node node)
        {
            var tempCommunity = new IterativeLocalExpansionCommunity(this);

            tempCommunity.AddNodeToD(node);
            return(tempCommunity.ComputeR());
        }
Пример #2
0
        private static bool AddNodeToCommunity(IterativeLocalExpansionCommunity community)
        {
            Node   bestNode = null;
            double bestR    = community.ComputeR();

            foreach (var ni in community.S)
            {
                double r = community.ComputeRWithAddedNode(ni);
                if (r > bestR)
                {
                    bestR    = r;
                    bestNode = ni;
                }
            }

            if (bestNode == null)
            {
                return(false);
            }

            community.AddNodeToD(bestNode);
            Debug.WriteLine($"Added '{bestNode.Id}'");
            return(true);
        }