comparison env/lib/python3.9/site-packages/networkx/algorithms/tests/test_isolate.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 """Unit tests for the :mod:`networkx.algorithms.isolates` module."""
2
3 import networkx as nx
4
5
6 def test_is_isolate():
7 G = nx.Graph()
8 G.add_edge(0, 1)
9 G.add_node(2)
10 assert not nx.is_isolate(G, 0)
11 assert not nx.is_isolate(G, 1)
12 assert nx.is_isolate(G, 2)
13
14
15 def test_isolates():
16 G = nx.Graph()
17 G.add_edge(0, 1)
18 G.add_nodes_from([2, 3])
19 assert sorted(nx.isolates(G)) == [2, 3]
20
21
22 def test_number_of_isolates():
23 G = nx.Graph()
24 G.add_edge(0, 1)
25 G.add_nodes_from([2, 3])
26 assert nx.number_of_isolates(G) == 2