How I Find Cluster in C# using ClusterClass

May 30, 2010 at 12:16 PM

Hello Sir,

PLease help me i want to find cluster to make different communities visible but i have no idea how i do that , the help file is very brief and i stuck on it please give me some code to find the cluster ...





Mustafa Ali



May 30, 2010 at 5:51 PM

1.  Add a reference to the Microsoft.NodeXL.Algorithms assembly.

2.  Add this statement to the top of your CS file:

    using Microsoft.NodeXL.Algorithms;

3. Create a ClusterCalculator object:

    ClusterCalculator oClusterCalculator = new ClusterCalculator();

4. Select a cluster algorithm:

    oClusterCalculator.Algorithm = ClusterAlgorithm.WakitaTsurumi;

5. Tell the ClusterCalculator to calculate clusters:

    ICollection<Community> oCommunities = (ICollection<Community>)

6. Loop through the calculated clusters:

        foreach (Community oCommunity in oCommunities)
            foreach (IVertex oVertex in oCommunity.Vertices)
                // Do something with the vertex.

Jun 1, 2010 at 11:55 AM

Dear Tony,

i m unable to find this Line 'ClusterCalculator oClusterCalculator = new ClusterCalculator();' . i m using Class Libraries Of NodeXLClassLibraries_1.0.1.121 so please give me the details of The Version Of NODEXL u using ....



I m awaiting for your answer


Jun 1, 2010 at 3:58 PM
Edited Jun 1, 2010 at 4:02 PM


If you are using version, then I would expect the compiler to issue an error for step 4, because the ClusterCalculator.Algorithm property didn't exist in that version.  (It does exist in version, the latest version and the one I used to test the above code.)  Just eliminate step 4.

But you said that there was a problem with step 3, not step 4.  Are you sure about that?  There was definitely a ClusterCalculator class in version, so I wouldn't expect a problem there.

If eliminating step 4 does not fix the problem, please paste the exact compiler error message here.

-- Tony