本文整理汇总了Golang中github.com/soniakeys/cluster.DistanceMatrix.AdditiveTree方法的典型用法代码示例。如果您正苦于以下问题:Golang DistanceMatrix.AdditiveTree方法的具体用法?Golang DistanceMatrix.AdditiveTree怎么用?Golang DistanceMatrix.AdditiveTree使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/soniakeys/cluster.DistanceMatrix
的用法示例。
在下文中一共展示了DistanceMatrix.AdditiveTree方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: ExampleDistanceMatrix_AdditiveTree
func ExampleDistanceMatrix_AdditiveTree() {
d := cluster.DistanceMatrix{
{0, 13, 21, 22},
{13, 0, 12, 13},
{21, 12, 0, 13},
{22, 13, 13, 0},
}
t, wts := d.AdditiveTree()
for n, to := range t.LabeledAdjacencyList {
for _, to := range to {
fmt.Printf("%d: to %d label %d weight %g\n",
n, to.To, to.Label, wts[to.Label])
}
}
// Output:
// 0: to 4 label 1 weight 11
// 1: to 4 label 0 weight 2
// 2: to 5 label 2 weight 6
// 3: to 5 label 4 weight 7
// 4: to 1 label 0 weight 2
// 4: to 0 label 1 weight 11
// 4: to 5 label 3 weight 4
// 5: to 2 label 2 weight 6
// 5: to 4 label 3 weight 4
// 5: to 3 label 4 weight 7
}