Example #1
0
        protected void Receive(Node sender)
        {
            bool found = false;

            for (int i = 0; i < Edges.Count; i++)
            {
                if (Edges[i].Equals(sender))
                {
                    found          = true;
                    EdgeWeight[i] += 1;
                }
            }

            if (!found)
            {
                Edges.Add(sender);
                EdgeWeight.Add(1);
            }
        }
Example #2
0
        public void SendMessage(Node recipient)
        {
            recipient.Receive(this);
            bool found = false;

            for (int i = 0; i < Edges.Count; i++)
            {
                if (Edges[i].Equals(recipient))
                {
                    found          = true;
                    EdgeWeight[i] += 1;
                }
            }

            if (!found)
            {
                Edges.Add(recipient);
                EdgeWeight.Add(1);
            }
        }