public Partition GetPartition() { //Get our graph LightWeightGraph lwg = VATResult.GetAttackedGraphWithReassignment(); //Get our cluster Assignment List <List <int> > componentList = lwg.GetComponents(); //Setup our Clusters List <Cluster> clusterList = new List <Cluster>(); for (int i = 0; i < componentList.Count; i++) { Cluster c = new Cluster(i); foreach (var n in componentList[i]) { c.AddPoint(new ClusteredItem(n)); } clusterList.Add(c); } String meta = "VATClust: \nRemoved Count:" + VATResult.numNodesRemoved + "\n" + String.Join(",", VATResult.nodeRemovalOrder.GetRange(0, VATResult.numNodesRemoved)); return(new Partition(clusterList, _distanceMatrix, meta)); }
public static Partition GetPartition(LightWeightGraph lwg) { //Get our cluster Assignment List <List <int> > componentList = lwg.GetComponents(); //Setup our Clusters List <Cluster> clusterList = new List <Cluster>(); for (int i = 0; i < componentList.Count; i++) { Cluster c = new Cluster(i); foreach (var n in componentList[i]) { c.AddPoint(new ClusteredItem(lwg[n].Label)); } clusterList.Add(c); } return(new Partition(clusterList, lwg)); }