Commit 36834b36 by Yoann Dufresne

### Distance tests for d2 creation ok on linear graphs

parent aa4f017b
 ... ... @@ -46,21 +46,35 @@ class TestD2Graph(unittest.TestCase): # Test index awaited_index_size = comb(2*d+1, index_k) + (size - (2*d+1)) * comb(2*d, index_k-1) # print(d, size, index_k, awaited_index_size) if len(d2.index) != awaited_index_size: dmers = [list(x) for x in d2.index] dmers = [x for x in dmers if len(x) != len(frozenset(x))] dmers = [str(x) for x in dmers if len(x) != len(frozenset(x))] dmers = [str(x) for x in dmers] # print("\n".join(dmers)) self.assertEquals(awaited_index_size, len(d2.index)) d2_nx = d2.nx_graph # print(d2_nx.nodes()) # print(d2_nx.edges()) # Test connectivity # Test connectivity # Center node names c1 = d c2 = d+1 c3 = d+2 # Connectivity matrix awaited_distances = { c1:{c2:2, c3:4}, c2:{c1:2, c3:2}, c3:{c1:4, c2:2} } # distance tests for idx1, neighbors in d2.distances.items(): dg1 = d2.node_by_idx[idx1] for idx2, dist in neighbors.items(): dg2 = d2.node_by_idx[idx2] awaited_dist = awaited_distances[dg1.center][dg2.center] self.assertEquals(dist, awaited_dist) if __name__ == "__main__": ... ...
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!