create edge between the nodes
(nodes, graph, cluster, c1)
| 128 | |
| 129 | |
| 130 | def create_edge(nodes, graph, cluster, c1): |
| 131 | """ |
| 132 | create edge between the nodes |
| 133 | """ |
| 134 | for i in cluster[c1]: |
| 135 | count = 0 |
| 136 | c2 = c1 + 1 |
| 137 | while c2 < max(cluster.keys()): |
| 138 | for j in cluster[c2]: |
| 139 | """ |
| 140 | creates edge only if the condition satisfies |
| 141 | """ |
| 142 | if int(i, 2) & int(j, 2) == int(i, 2): |
| 143 | if tuple(nodes[i]) in graph: |
| 144 | graph[tuple(nodes[i])].append(nodes[j]) |
| 145 | else: |
| 146 | graph[tuple(nodes[i])] = [nodes[j]] |
| 147 | count += 1 |
| 148 | if count == 0: |
| 149 | c2 = c2 + 1 |
| 150 | else: |
| 151 | break |
| 152 | |
| 153 | |
| 154 | def construct_graph(cluster, nodes): |
no test coverage detected