Wolfram 语言

图与网络

聚类树

用版本 11 中新增的 ClusteringTree 函数构建并可视化任意数据的层次聚类.

基于相互接近程度的城市的聚类.

In[1]:=
Click for copyable input
ClusteringTree[{Entity[ "City", {"London", "GreaterLondon", "UnitedKingdom"}], Entity["City", {"Paris", "IleDeFrance", "France"}], Entity["City", {"Chicago", "Illinois", "UnitedStates"}], Entity["City", {"Tokyo", "Tokyo", "Japan"}], Entity["City", {"Boston", "Massachusetts", "UnitedStates"}], Entity["City", {"Moscow", "Moscow", "Russia"}], Entity["City", {"SanDiego", "California", "UnitedStates"}], Entity["City", {"Baltimore", "Maryland", "UnitedStates"}]}]
Out[1]=

从一个颜色列表得到一个聚类层次.

In[2]:=
Click for copyable input
colors = RandomColor[18]
Out[2]=
In[3]:=
Click for copyable input
ClusteringTree[colors, ClusterDissimilarityFunction -> "Centroid"]
Out[3]=

选用一个不同的 GraphLayout.

In[4]:=
Click for copyable input
ClusteringTree[RandomColor[40], ClusterDissimilarityFunction -> "Centroid", GraphLayout -> "RadialDrawing"]
Out[4]=

相关范例

de en es fr ja ko pt-br ru