func ExampleDistanceMatrix_Ultrametric() { d := cluster.DistanceMatrix{ {0, 20, 17, 11}, {20, 0, 20, 13}, {17, 20, 0, 10}, {11, 13, 10, 0}, } pl, ul := d.Ultrametric(cluster.DAVG) fmt.Println("node leaves parent weight age") for n, p := range pl.Paths { fmt.Printf(">%3d %3d %3d %6.3f %6.3f\n", n, p.Len, p.From, ul[n].Weight, ul[n].Age) } // Output: // node leaves parent weight age // > 0 1 5 7.000 0.000 // > 1 1 6 8.833 0.000 // > 2 1 4 5.000 0.000 // > 3 1 4 5.000 0.000 // > 4 2 5 2.000 5.000 // > 5 3 6 1.833 7.000 // > 6 4 -1 NaN 8.833 }