(self)
| 160 | assert nodes_equal(G, list(self.G)) |
| 161 | |
| 162 | def test_add_cycle(self): |
| 163 | G = self.G.copy() |
| 164 | nlist = [12, 13, 14, 15] |
| 165 | oklists = [ |
| 166 | [(12, 13), (12, 15), (13, 14), (14, 15)], |
| 167 | [(12, 13), (13, 14), (14, 15), (15, 12)], |
| 168 | ] |
| 169 | nx.add_cycle(G, nlist) |
| 170 | assert sorted(G.edges(nlist)) in oklists |
| 171 | G = self.G.copy() |
| 172 | oklists = [ |
| 173 | [ |
| 174 | (12, 13, {"weight": 1.0}), |
| 175 | (12, 15, {"weight": 1.0}), |
| 176 | (13, 14, {"weight": 1.0}), |
| 177 | (14, 15, {"weight": 1.0}), |
| 178 | ], |
| 179 | [ |
| 180 | (12, 13, {"weight": 1.0}), |
| 181 | (13, 14, {"weight": 1.0}), |
| 182 | (14, 15, {"weight": 1.0}), |
| 183 | (15, 12, {"weight": 1.0}), |
| 184 | ], |
| 185 | ] |
| 186 | nx.add_cycle(G, nlist, weight=1.0) |
| 187 | assert sorted(G.edges(nlist, data=True)) in oklists |
| 188 | |
| 189 | G = self.G.copy() |
| 190 | nlist = [12] |
| 191 | nx.add_cycle(G, nlist) |
| 192 | assert nodes_equal(G, list(self.G) + nlist) |
| 193 | |
| 194 | G = self.G.copy() |
| 195 | nlist = [] |
| 196 | nx.add_cycle(G, nlist) |
| 197 | assert nodes_equal(G.nodes, self.Gnodes) |
| 198 | assert edges_equal(G.edges, self.G.edges) |
| 199 | |
| 200 | def test_subgraph(self): |
| 201 | assert ( |
nothing calls this directly
no test coverage detected