def test_minimumDistance_trivial_4d(self): d = 4 c1 = Cluster([(0.0, 0.0, 0.0, 0.0)], d) c2 = Cluster([(1.0, 0.0, 0.0, 0.0)], d) clusters = ClusterContainer([c1, c2], d) g = createDistanceGraph(clusters.getClusters()) (u, v) = minimumEdge(g) self.assertEquals(g[u][v]['weight'], 1.0, "la minima arista tiene peso 1")
def test_minimunDistanceOnlyOneSamplesForCluster_4D(self): d = 4 c1 = Cluster([(2.0, 6.0, 0.0, 0.0)], d) c2 = Cluster([(2.0, 2.0, 0.0, 0.0)], d) c3 = Cluster([(5.0, 6.0, 0.0, 0.0)], d) c4 = Cluster([(5.0, 2.0, 0.0, 0.0)], d) clusters = ClusterContainer([c1, c2, c3, c4], d) g = createDistanceGraph(clusters.getClusters()) (u, v) = minimumEdge(g) self.assertEquals(g[u][v]['weight'], 3.0, "la minima arista tiene peso 3")
def test_minimumDistance_severalSamplesInClusters_2D(self): d = 2 c1 = Cluster([(1.0, 7.0), (3.0, 7.0), (1.0, 5.0), (3.0, 5.0)], d) c2 = Cluster([(1.0, 3.0), (3.0, 3.0), (1.0, 1.0), (3.0, 1.0)], d) c3 = Cluster([(4.0, 7.0), (6.0, 5.0), (6.0, 7.0), (4.0, 5.0)], d) c4 = Cluster([(4.0, 3.0), (4.0, 1.0), (6.0, 1.0), (6.0, 3.0)], d) clusters = ClusterContainer([c1, c2, c3, c4], d) g = createDistanceGraph(clusters.getClusters()) (u, v) = minimumEdge(g) self.assertEquals(g[u][v]['weight'], 3.0, "la minima arista tiene peso 3")