(N=1)
| 301 | |
| 302 | |
| 303 | def test_topological_ordering(N=1): |
| 304 | np.random.seed(12345) |
| 305 | i = 0 |
| 306 | while i < N: |
| 307 | p = np.random.uniform(0.25, 1) |
| 308 | n_v = np.random.randint(5, 10) |
| 309 | |
| 310 | G = random_DAG(n_v, p) |
| 311 | G_nx = to_networkx(G) |
| 312 | |
| 313 | if nx.is_directed_acyclic_graph(G_nx): |
| 314 | topo_order = G.topological_ordering() |
| 315 | |
| 316 | # test topological order |
| 317 | seen_it = set() |
| 318 | for n_i in topo_order: |
| 319 | seen_it.add(n_i) |
| 320 | assert any([c_i in seen_it for c_i in G.get_neighbors(n_i)]) == False |
| 321 | |
| 322 | print("PASSED") |
| 323 | i += 1 |
| 324 | |
| 325 | |
| 326 | def test_is_acyclic(N=1): |
nothing calls this directly
no test coverage detected