This repository has been archived on 2023-03-25. You can view files and clone it, but cannot push or open issues or pull requests.
mightyscape-1.1-deprecated/extensions/networkx/algorithms/tests/test_non_randomness.py
2020-07-30 01:16:18 +02:00

14 lines
394 B
Python

#!/usr/bin/env python
import networkx as nx
import pytest
numpy = pytest.importorskip('numpy')
npt = pytest.importorskip('numpy.testing')
def test_non_randomness():
G = nx.karate_club_graph()
npt.assert_almost_equal(nx.non_randomness(G, 2)[0], 11.7, decimal=2)
npt.assert_almost_equal(nx.non_randomness(G)[0],
7.21, decimal=2) # infers 3 communities