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 }