troubleshooting Question

Find Cluster representative

Avatar of dadadude
dadadude asked on
Programming Languages-OtherAlgorithms
2 Comments2 Solutions270 ViewsLast Modified:
I have a cluster C = [v1,v2,...,Vn] i am trying to find a Vector vi that can be the representative of that cluster, and i don't think that what i am doing is right, that's the pseudo code:
in the code:
I do the following:
For all vectors in C (i)
    sum = 0
     For all vectors in C (j)
            sum+ = d(vi,vj);
   // add distance and vector to a list

find the vector with the minimum distance. Is that wrong?
thank you
List<Values> distance = new List<Values>();
        for (int i = 0; i < tab.Count; i++)
            double sum = 0.0;  
            for (int j = 0; j < tab.Count; j++)
               //tab[i] and tab[j] are 2 vectors
                sum += ManhattanDistance(tab[i],tab[j]);
            distance.Add(new Values(tab[i],sum));
        }//end for
        return distance[0].Vector;
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 2 Answers and 2 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros