Exemple #1
0
        public vertex GetleaderNode(vertex v1)
        {
            vertex temp = v1;

            while (temp.leader != temp)
            {
                temp = temp.leader;
            }
            return(temp);
        }
Exemple #2
0
        public vertex merge(vertex v1, vertex v2)
        {
            var    g  = new GetLeader();
            vertex L1 = g.GetleaderNode(v1);
            vertex L2 = g.GetleaderNode(v2);

            if (L1 != L2)
            {
                if (L1.data > L2.data)
                {
                    return(L1.leader);
                }
                else
                {
                    return(L2.leader);
                }
            }
            return(L1.leader);
        }
Exemple #3
0
 public void Merge(vertex v1, vertex v2);
Exemple #4
0
 private void getleader(vertex v1);
Exemple #5
0
 public vertex()
 {
     leader = this;
 }