comparison env/lib/python3.9/site-packages/networkx/algorithms/tests/test_hybrid.py @ 0:4f3585e2f14b draft default tip

"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
author shellac
date Mon, 22 Mar 2021 18:12:50 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:4f3585e2f14b
1 import networkx as nx
2
3
4 def test_2d_grid_graph():
5 # FC article claims 2d grid graph of size n is (3,3)-connected
6 # and (5,9)-connected, but I don't think it is (5,9)-connected
7 G = nx.grid_2d_graph(8, 8, periodic=True)
8 assert nx.is_kl_connected(G, 3, 3)
9 assert not nx.is_kl_connected(G, 5, 9)
10 (H, graphOK) = nx.kl_connected_subgraph(G, 5, 9, same_as_graph=True)
11 assert not graphOK
12
13
14 def test_small_graph():
15 G = nx.Graph()
16 G.add_edge(1, 2)
17 G.add_edge(1, 3)
18 G.add_edge(2, 3)
19 assert nx.is_kl_connected(G, 2, 2)
20 H = nx.kl_connected_subgraph(G, 2, 2)
21 (H, graphOK) = nx.kl_connected_subgraph(
22 G, 2, 2, low_memory=True, same_as_graph=True
23 )
24 assert graphOK