- 浏览: 529714 次
- 性别:
- 来自: 山东济南
文章分类
最新评论
-
dragon_8844:
非常不错,nice
java.util.concurrent 多线程框架 -
wusendong:
很好的文章!受益匪浅,谢谢!
java.util.concurrent 多线程框架 -
SINCE1978:
你也关注并发啊
java.util.concurrent 多线程框架 -
lku1314:
这个不错 刚刚找到这个组建 以前孤陋寡闻了 像lz学习!标 ...
quartz 在WEB中应用小结 -
lliiqiang:
人们对于目标需要的需求明确的去做,对于目标以外的因素是随机的执 ...
flex和后端的数据交互(一)--XML和HTTPService
ClusterMain.java
package eu.eodigos.kmean; import java.util.Iterator; import java.util.List; import java.util.Vector; import eu.eodigos.hibernate.bean.ClusterInput; import eu.eodigos.hibernate.server.AccessDBServer; import eu.eodigos.hibernate.server.AccessDBServerImp; /** * @author daoger * @version 1.0 * @k-mean Cluster */ public class ClusterMain { public static void main(String[] args) { ClusterMain clusterMain = new ClusterMain(); clusterMain.clusterByDatabase(); } /** * Test with manual data */ public void test() { Vector<DataPoint> dataPoints = new Vector<DataPoint>(); dataPoints.add(new DataPoint(0.12, 0.21, 0.26, 0.45, 0.67, 0.23, 0.11, new Integer(1))); dataPoints.add(new DataPoint(0.22, 0.23, 0.46, 0.11, 0.63, 0.11, 0.12, new Integer(2))); dataPoints.add(new DataPoint(0.32, 0.34, 0.78, 0.17, 0.68, 0.67, 0.13, new Integer(3))); dataPoints.add(new DataPoint(0.42, 0.45, 0.26, 0.42, 0.48, 0.39, 0.14, new Integer(4))); dataPoints.add(new DataPoint(0.52, 0.29, 0.65, 0.59, 0.16, 0.74, 0.15, new Integer(5))); dataPoints.add(new DataPoint(0.62, 0.25, 0.48, 0.61, 0.27, 0.16, 0.67, new Integer(6))); dataPoints.add(new DataPoint(0.72, 0.35, 0.39, 0.20, 0.65, 0.26, 0.17, new Integer(7))); dataPoints.add(new DataPoint(0.82, 0.20, 0.16, 0.29, 0.32, 0.61, 0.18, new Integer(8))); dataPoints.add(new DataPoint(0.92, 0.71, 0.26, 0.37, 0.17, 0.81, 0.19, new Integer(9))); dataPoints.add(new DataPoint(0.13, 0.39, 0.17, 0.41, 0.47, 0.37, 0.10, new Integer(10))); dataPoints.add(new DataPoint(0.14, 0.23, 0.47, 0.93, 0.68, 0.28, 0.29, new Integer(11))); dataPoints.add(new DataPoint(0.15, 0.57, 0.84, 0.19, 0.15, 0.39, 0.39, new Integer(12))); dataPoints.add(new DataPoint(0.16, 0.19, 0.45, 0.38, 0.36, 0.82, 0.49, new Integer(13))); dataPoints.add(new DataPoint(0.17, 0.89, 0.29, 0.39, 0.82, 0.58, 0.59, new Integer(14))); // divide all user to 7 cluster // 10000 stand for precision,the bigger of this value the more accuratly ClusterAssistant clusterAssistant = new ClusterAssistant(3, 10000, dataPoints); clusterAssistant.startAnalysis(); Vector[] v = clusterAssistant.getClusterOutput(); for (int i = 0; i < v.length; i++) { Vector tempV = v[i]; System.out.println("-----------Cluster" + i + "---------"); Iterator iter = tempV.iterator(); while (iter.hasNext()) { DataPoint dpTemp = (DataPoint) iter.next(); String dps = "userid_" + dpTemp.getUserid() + "[" + dpTemp.getAvg1() + "," + dpTemp.getAvg2() + dpTemp.getAvg3() + "," + dpTemp.getAvg4() + "," + dpTemp.getAvg5() + "," + dpTemp.getAvg6() + "," + dpTemp.getAvg7() + "]"; System.out.println(dps); } } } /** * get data from database and calaulate */ public void clusterByDatabase() { AccessDBServer access = new AccessDBServerImp(); Vector<DataPoint> dataPoints = new Vector<DataPoint>(); List clusterList = access.getAllClusterInputData(); for (Iterator iter = clusterList.iterator(); iter.hasNext();) { ClusterInput clusterInput = (ClusterInput) iter.next(); if (clusterInput != null) { dataPoints.add(new DataPoint(clusterInput.getAvgArch(), clusterInput.getAvgMon(), clusterInput .getAvgMus(), clusterInput.getAvgBuil(), clusterInput.getAvgChap(), clusterInput.getAvgBeach(), clusterInput.getAvgWalk(), clusterInput.getClusterId())); } } // divide all user to 7 cluster // 10000 stand for precision,the bigger of this value the more accuratly ClusterAssistant clusterAssistant = new ClusterAssistant(7, 10000, dataPoints); clusterAssistant.startAnalysis(); Vector[] v = clusterAssistant.getClusterOutput(); for (int i = 0; i < v.length; i++) { Vector tempV = v[i]; Iterator iter = tempV.iterator(); while (iter.hasNext()) { DataPoint dpTemp = (DataPoint) iter.next(); access.updateClusterCateOfUsers(dpTemp.getUserid(), new Integer(i + 1)); } } } }
ClusterAssistant.java
package eu.eodigos.kmean; import java.util.Vector; /** * @author daoger * @version 1.0 * @k-mean Cluster */ public class ClusterAssistant { private Cluster[] clusters; private int miter; private Vector mDataPoints = new Vector(); private double mSWCSS; public ClusterAssistant(int k, int iter, Vector dataPoints) { clusters = new Cluster[k]; for (int i = 0; i < k; i++) { clusters[i] = new Cluster("Cluster" + i); } this.miter = iter; this.mDataPoints = dataPoints; } private void calcSWCSS() { double temp = 0; for (int i = 0; i < clusters.length; i++) { temp = temp + clusters[i].getSumSqr(); } mSWCSS = temp; } public void startAnalysis() { setInitialCentroids(); int n = 0; loop1: while (true) { for (int l = 0; l < clusters.length; l++) { clusters[l].addDataPoint((DataPoint) mDataPoints.elementAt(n)); n++; if (n >= mDataPoints.size()) break loop1; } } calcSWCSS(); for (int i = 0; i < clusters.length; i++) { clusters[i].getCentroid().calcCentroid(); } calcSWCSS(); for (int i = 0; i < miter; i++) { for (int j = 0; j < clusters.length; j++) { for (int k = 0; k < clusters[j].getNumDataPoints(); k++) { double tempEuDt = clusters[j].getDataPoint(k).getCurrentEuDt(); Cluster tempCluster = null; boolean matchFoundFlag = false; for (int l = 0; l < clusters.length; l++) { if (tempEuDt > clusters[j].getDataPoint(k).testEuclideanDistance(clusters[l].getCentroid())) { tempEuDt = clusters[j].getDataPoint(k).testEuclideanDistance(clusters[l].getCentroid()); tempCluster = clusters[l]; matchFoundFlag = true; } } if (matchFoundFlag) { tempCluster.addDataPoint(clusters[j].getDataPoint(k)); clusters[j].removeDataPoint(clusters[j].getDataPoint(k)); for (int m = 0; m < clusters.length; m++) { clusters[m].getCentroid().calcCentroid(); } calcSWCSS(); } } } } } public Vector[] getClusterOutput() { Vector v[] = new Vector[clusters.length]; for (int i = 0; i < clusters.length; i++) { v[i] = clusters[i].getDataPoints(); } return v; } private void setInitialCentroids() { // kn = (round((max-min)/k)*n)+min where n is from 0 to (k-1). double[] c = new double[7]; for (int n = 1; n <= clusters.length; n++) { for (int i = 1; i < 8; i++) { c[i - 1] = (((getMaxXValue(i) - getMinXValue(i)) / (clusters.length + 1)) * n) + getMinXValue(i); } Centroid ce = new Centroid(c[0], c[1], c[2], c[3], c[4], c[5], c[6]); clusters[n - 1].setCentroid(ce); ce.setCluster(clusters[n - 1]); } } private double getMaxXValue(int avgnumber) { double temp = 0.0; switch (avgnumber) { case 1:// Archeological temp = ((DataPoint) mDataPoints.elementAt(0)).getAvg1(); break; case 2:// Monuments temp = ((DataPoint) mDataPoints.elementAt(0)).getAvg2(); break; case 3:// Museums temp = ((DataPoint) mDataPoints.elementAt(0)).getAvg3(); break; case 4:// Buildings temp = ((DataPoint) mDataPoints.elementAt(0)).getAvg4(); break; case 5:// Chapels temp = ((DataPoint) mDataPoints.elementAt(0)).getAvg5(); break; case 6:// Beaches temp = ((DataPoint) mDataPoints.elementAt(0)).getAvg6(); break; case 7:// Walking temp = ((DataPoint) mDataPoints.elementAt(0)).getAvg7(); break; } for (int i = 0; i < mDataPoints.size(); i++) { DataPoint dp = (DataPoint) mDataPoints.elementAt(i); switch (avgnumber) { case 1:// Archeological temp = (dp.getAvg1() > temp) ? dp.getAvg1() : temp; break; case 2:// Monuments temp = (dp.getAvg2() > temp) ? dp.getAvg2() : temp; break; case 3:// Museums temp = (dp.getAvg3() > temp) ? dp.getAvg3() : temp; break; case 4:// Buildings temp = (dp.getAvg4() > temp) ? dp.getAvg4() : temp; break; case 5:// Chapels temp = (dp.getAvg5() > temp) ? dp.getAvg5() : temp; break; case 6:// Beaches temp = (dp.getAvg6() > temp) ? dp.getAvg6() : temp; break; case 7:// Walking temp = (dp.getAvg7() > temp) ? dp.getAvg7() : temp; break; } } return temp; } private double getMinXValue(int avgnumber) { double temp = 0.0; switch (avgnumber) { case 1:// Archeological temp = ((DataPoint) mDataPoints.elementAt(0)).getAvg1(); break; case 2:// Monuments temp = ((DataPoint) mDataPoints.elementAt(0)).getAvg2(); break; case 3:// Museums temp = ((DataPoint) mDataPoints.elementAt(0)).getAvg3(); break; case 4:// Buildings temp = ((DataPoint) mDataPoints.elementAt(0)).getAvg4(); break; case 5:// Chapels temp = ((DataPoint) mDataPoints.elementAt(0)).getAvg5(); break; case 6:// Beaches temp = ((DataPoint) mDataPoints.elementAt(0)).getAvg6(); break; case 7:// Walking temp = ((DataPoint) mDataPoints.elementAt(0)).getAvg7(); break; } for (int i = 0; i < mDataPoints.size(); i++) { DataPoint dp = (DataPoint) mDataPoints.elementAt(i); switch (avgnumber) { case 1:// Archeological temp = (dp.getAvg1() < temp) ? dp.getAvg1() : temp; break; case 2:// Monuments temp = (dp.getAvg2() < temp) ? dp.getAvg2() : temp; break; case 3:// Museums temp = (dp.getAvg3() < temp) ? dp.getAvg3() : temp; break; case 4:// Buildings temp = (dp.getAvg4() < temp) ? dp.getAvg4() : temp; break; case 5:// Chapels temp = (dp.getAvg5() < temp) ? dp.getAvg5() : temp; break; case 6:// Beaches temp = (dp.getAvg6() < temp) ? dp.getAvg6() : temp; break; case 7:// Walking temp = (dp.getAvg7() < temp) ? dp.getAvg7() : temp; break; } } return temp; } public int getKValue() { return clusters.length; } public int getIterations() { return miter; } public int getTotalDataPoints() { return mDataPoints.size(); } public double getSWCSS() { return mSWCSS; } public Cluster getCluster(int pos) { return clusters[pos]; } }
Centroid.java
package eu.eodigos.kmean; /** * @author daoger * @version 1.0 * @k-mean Cluster */ class Centroid { private double avgC1, avgC2, avgC3, avgC4, avgC5, avgC6, avgC7; private Cluster mCluster; public Centroid(double ac1, double ac2, double ac3, double ac4, double ac5, double ac6, double ac7) { this.avgC1 = ac1; this.avgC2 = ac2; this.avgC3 = ac3; this.avgC4 = ac4; this.avgC5 = ac5; this.avgC6 = ac6; this.avgC7 = ac7; } public void calcCentroid() { // only called by CAInstance int numDP = mCluster.getNumDataPoints(); double temp1 = 0, temp2 = 0, temp3 = 0, temp4 = 0, temp5 = 0, temp6 = 0, temp7 = 0; int i; // caluclating the new Centroid for (i = 0; i < numDP; i++) { temp1 = temp1 + mCluster.getDataPoint(i).getAvg1(); // total for avg1 temp2 = temp2 + mCluster.getDataPoint(i).getAvg2(); // total for avg1 temp3 = temp3 + mCluster.getDataPoint(i).getAvg3(); // total for avg1 temp4 = temp4 + mCluster.getDataPoint(i).getAvg4(); // total for avg1 temp5 = temp5 + mCluster.getDataPoint(i).getAvg5(); // total for avg1 temp6 = temp6 + mCluster.getDataPoint(i).getAvg6(); // total for avg1 temp7 = temp7 + mCluster.getDataPoint(i).getAvg7(); // total for avg1 } this.avgC1 = temp1 / numDP; this.avgC2 = temp2 / numDP; this.avgC3 = temp3 / numDP; this.avgC4 = temp4 / numDP; this.avgC5 = temp5 / numDP; this.avgC6 = temp6 / numDP; this.avgC7 = temp7 / numDP; // calculating the new Euclidean Distance for each Data Point temp1 = 0; temp2 = 0; temp3 = 0; temp4 = 0; temp5 = 0; temp6 = 0; temp7 = 0; for (i = 0; i < numDP; i++) { mCluster.getDataPoint(i).calcEuclideanDistance(); } // calculate the new Sum of Squares for the Cluster mCluster.calcSumOfSquares(); } public void setCluster(Cluster c) { this.mCluster = c; } public double getAvgC1() { return avgC1; } public void setAvgC1(double avgC1) { this.avgC1 = avgC1; } public double getAvgC2() { return avgC2; } public void setAvgC2(double avgC2) { this.avgC2 = avgC2; } public double getAvgC3() { return avgC3; } public void setAvgC3(double avgC3) { this.avgC3 = avgC3; } public double getAvgC4() { return avgC4; } public void setAvgC4(double avgC4) { this.avgC4 = avgC4; } public double getAvgC5() { return avgC5; } public void setAvgC5(double avgC5) { this.avgC5 = avgC5; } public double getAvgC6() { return avgC6; } public void setAvgC6(double avgC6) { this.avgC6 = avgC6; } public double getAvgC7() { return avgC7; } public void setAvgC7(double avgC7) { this.avgC7 = avgC7; } public Cluster getCluster() { return mCluster; } }
Cluster.java
package eu.eodigos.kmean; import java.util.Vector; /** * @author daoger * @version 1.0 * @k-mean Cluster */ class Cluster { private String mName; private Centroid mCentroid; private double mSumSqr; private Vector<DataPoint> mDataPoints; public Cluster(String name) { this.mName = name; this.mCentroid = null; // will be set by calling setCentroid() mDataPoints = new Vector<DataPoint>(); } public void setCentroid(Centroid c) { mCentroid = c; } public Centroid getCentroid() { return mCentroid; } public void addDataPoint(DataPoint dp) { // called from CAInstance dp.setCluster(this); // initiates a inner call to calcEuclideanDistance() in DP. this.mDataPoints.addElement(dp); calcSumOfSquares(); } public void removeDataPoint(DataPoint dp) { this.mDataPoints.removeElement(dp); calcSumOfSquares(); } public int getNumDataPoints() { return this.mDataPoints.size(); } public DataPoint getDataPoint(int pos) { return (DataPoint) this.mDataPoints.elementAt(pos); } public void calcSumOfSquares() { // called from Centroid int size = this.mDataPoints.size(); double temp = 0; for (int i = 0; i < size; i++) { temp = temp + ((DataPoint) this.mDataPoints.elementAt(i)).getCurrentEuDt(); } this.mSumSqr = temp; } public double getSumSqr() { return this.mSumSqr; } public String getName() { return this.mName; } public Vector getDataPoints() { return this.mDataPoints; } }
DataPoint.java
package eu.eodigos.kmean; /** * @author daoger * @version 1.0 * @k-mean Cluster */ public class DataPoint { private double avg1, avg2, avg3, avg4, avg5, avg6, avg7; private Integer userid; private Cluster mCluster; private double mEuDt; public DataPoint(double avg1, double avg2, double avg3, double avg4, double avg5, double avg6, double avg7, Integer userid) { this.avg1 = avg1; this.avg2 = avg2; this.avg3 = avg3; this.avg4 = avg4; this.avg5 = avg5; this.avg6 = avg6; this.avg7 = avg7; this.userid = userid; this.mCluster = null; } public void setCluster(Cluster cluster) { this.mCluster = cluster; calcEuclideanDistance(); } public void calcEuclideanDistance() { // called when DP is added to a cluster or when a Centroid is // recalculated. mEuDt = Math.sqrt(Math.pow((avg1 - mCluster.getCentroid().getAvgC1()), 2) + Math.pow((avg2 - mCluster.getCentroid().getAvgC2()), 2) + Math.pow((avg3 - mCluster.getCentroid().getAvgC3()), 2) + Math.pow((avg4 - mCluster.getCentroid().getAvgC4()), 2) + Math.pow((avg5 - mCluster.getCentroid().getAvgC5()), 2) + Math.pow((avg6 - mCluster.getCentroid().getAvgC6()), 2) + Math.pow((avg7 - mCluster.getCentroid().getAvgC7()), 2)); } public double testEuclideanDistance(Centroid c) { return Math.sqrt(Math.pow((avg1 - c.getAvgC1()), 2) + Math.pow((avg2 - c.getAvgC2()), 2) + Math.pow((avg3 - c.getAvgC3()), 2) + Math.pow((avg4 - c.getAvgC4()), 2) + Math.pow((avg5 - c.getAvgC5()), 2) + Math.pow((avg6 - c.getAvgC6()), 2) + Math.pow((avg7 - c.getAvgC7()), 2)); } public double getAvg1() { return avg1; } public void setAvg1(double avg1) { this.avg1 = avg1; } public double getAvg2() { return avg2; } public void setAvg2(double avg2) { this.avg2 = avg2; } public double getAvg3() { return avg3; } public void setAvg3(double avg3) { this.avg3 = avg3; } public double getAvg4() { return avg4; } public void setAvg4(double avg4) { this.avg4 = avg4; } public double getAvg5() { return avg5; } public void setAvg5(double avg5) { this.avg5 = avg5; } public double getAvg6() { return avg6; } public void setAvg6(double avg6) { this.avg6 = avg6; } public double getAvg7() { return avg7; } public void setAvg7(double avg7) { this.avg7 = avg7; } public Cluster getCluster() { return mCluster; } public double getCurrentEuDt() { return mEuDt; } /** * @return the userid */ public Integer getUserid() { return userid; } /** * @param userid * the userid to set */ public void setUserid(Integer userid) { this.userid = userid; } }
发表评论
-
ubuntu14.04下编译安装Tora
2015-08-11 16:19 1199需预先安装oracle客户端;以下类库,有的可能需要提前安 ... -
ubuntu14.04下oracle客户端最小化安装
2015-08-11 16:04 1048在Oracle官网下载Oracle Instant Clien ... -
ubuntu14.04下编译安装QT
2015-08-11 16:03 14941. 首先配置一些编译Qt ... -
55种开源可视化数据分析工具
2015-07-22 14:50 0http://mp.weixin.qq.com/s?__bi ... -
响应式设计理念
2013-09-29 10:00 0概念 响应式Web设计(Responsive Web desi ... -
Liferay 使用随笔
2010-04-19 14:18 01.如何根据权限去除每一个portlet中右上角的选项。 关于 ... -
Liferay中ajax应用用户session超时
2010-03-26 09:31 3905基于Liferay Portal开发ajax应用时,如果长时间 ... -
Liferay portlet实例化配置
2009-11-10 09:06 4364在默认的情况下,一个p ... -
带checkbox的dhtmlxtree菜单树异步加载时的问题解决
2009-10-24 11:27 5955最近一直很忙,自己负责几个模块的设计开发,还有和其他服务接口的 ... -
JS代码示例
2009-10-21 14:23 22771.数组操作时的push var a = [],b = [ ... -
dhtmlxtree异步加载时的一个bug修正
2009-09-15 10:00 3803前面已经对dhtmlx的东西有所介绍,使用中也发现了不少bug ... -
WEB Page to PDF
2009-06-17 11:10 2521现在有很多网页页面转换成PDF文档的支持项目,我使用的是pd4 ... -
Liferay中使用dhtmlxlayout在IE下的问题
2009-06-12 13:43 2088Liferay 中使用dhemtlx系列UI的时候,dhtml ... -
Liferay相关配置
2009-06-10 13:35 1250修改liferay中portlet的加载目录 前面 ... -
Spring JDBC对Oracle10g数据库操作时RowSet的问题
2009-05-19 08:56 3435使用Spring JDBC对Oracle10g进行数据库分页的 ... -
Dynamic Tables In JavaScript for IE and Firefox
2009-05-06 14:03 1704http://www.sweetvision.com/2007 ... -
liferay中对struts桥接处理后的response
2009-04-18 14:29 1828对于在liferay开发平台中 ... -
liferay开发小记---Struts,Spring,Hibernate架构
2009-04-07 11:11 6249liferay有自己的struts和spring扩展,有兴趣的 ... -
liferay开发小记---portlet文件构造
2009-04-03 17:09 3277书接上回,说说portlet的开发,每一个portlet就是对 ... -
liferay开发小记---开发环境的搭建
2009-04-02 13:42 3797用惯了MyEclipse,我的环境也是在它上面搭建的,试用过M ...
相关推荐
K-SVD算法是一种有效的训练稀疏信号表示过完备字典的方法。在本文中,我们讨论了该算法的一种有效实现,它既加快了算法的速度,又降低了算法的内存消耗,即批处理OMP算法。 批处理OMP(Batch-OMP)是正交匹配追踪...
赠送jar包:pentaho-aggdesigner-algorithm-5.1.5-jhyde.jar; 赠送原API文档:pentaho-aggdesigner-algorithm-5.1.5-jhyde-javadoc.jar; 赠送源代码:pentaho-aggdesigner-algorithm-5.1.5-jhyde-sources.jar; ...
A Polynomial-time Algorithm for the Change-Making Problem Codeforces #10 E
mvn install:install-file -DgroupId=org.pentaho -DartifactId=pentaho-aggdesigner-algorithm -Dversion=5.1.5-jhyde -Dpackaging=jar -Dfile=D:/pentaho-aggdesigner-algorithm-5.1.5-jhyde.jar
C#,无监督的K-Medoid聚类算法(K-Medoid Algorithm)与源代码 K-Medoid(也称为围绕Medoid的划分)算法是由Kaufman和Rousseeuw于1987年提出的。中间点可以定义为簇中的点,其与簇中所有其他点的相似度最小。K-...
The Application of Sum-Product Algorithm for Data Association
Here we use k-mean algorithm to fuse the colorspace for segmentation
解决maven引入hive的jar包时依赖报错Could not find artifact org.pentaho:pentaho-aggdesigner-algorithm:pom:5.1.5-jhyde in xxx的问题,maven路径org/pentaho/pentaho-...aggdesigner-algorithm-5.1.5-jhyde.jar
org / pentaho / pentaho-aggdesigner-algorithm / 5.1.5-jhyde / pentaho-aggdesigner-algorithm-5.1.5-jhyde.jar,解决maven引入hive的jar包时依赖报错Could not find artifact org.pentaho:pentaho-aggdesigner-...
k-means algorithm using php
java maven 仓库包 pentaho-aggdesigner-algorithm-5.1.3-jhyde.jar
标题中的"pentaho-aggdesigner-algorithm-5.1.5-jhyde.jar"是一个特定版本的库文件,包含了用于聚合设计(Aggregation Design)的算法。这个版本号"5.1.5-jhyde"指示了这是 Pentaho AggDesigner Algorithm 的一个...
K-means算法源码 This directory contains code implementing the K-means algorithm. Source code ...number of cluster centers using the K-means algorithm. Output is directed to the screen.
"pentaho-aggdesigner-algorithm-5.1.5-jhyde.jar"正是为了解决这个问题而提供的文件。 Pentaho Data Integration(简称PDI,又称Kettle)是一个开源的数据集成工具,它允许用户从各种不同的数据源抽取、转换和加载...
C++标准库提供了一些工具,如`<vector>`用于动态数组,`<algorithm>`包含各种排序和查找算法,可以帮助实现k-均值算法。同时,可以利用多线程库如POSIX的`pthread`或C++11的`std::thread`进行并行计算,以加速聚类...
We propose a self-stabilizing algorithm for computing a maximal matching in an anony- mous network. The complexity is O(n2) moves with high probability, under the ad- versarial distributed daemon. ...