diff --git a/cdlib/benchmark/static_benchmark.py b/cdlib/benchmark/static_benchmark.py index 06573849..041339a7 100644 --- a/cdlib/benchmark/static_benchmark.py +++ b/cdlib/benchmark/static_benchmark.py @@ -1,10 +1,3 @@ -from networkx.generators.community import ( - LFR_benchmark_graph, - gaussian_random_partition_graph, - planted_partition_graph, - random_partition_graph, - stochastic_block_model, -) from cdlib.benchmark.internal import xmark import cdlib from cdlib import NodeClustering @@ -61,6 +54,8 @@ def LFR( .. note:: Reference implementation: https://networkx.org/documentation/stable/reference/generated/networkx.generators.community.LFR_benchmark_graph.html#networkx.generators.community.LFR_benchmark_graph """ + from networkx.generators.community import LFR_benchmark_graph + G = LFR_benchmark_graph( n=n, tau1=tau1, @@ -224,6 +219,9 @@ def GRP( .. note:: Reference implementation: https://networkx.org/documentation/stable/reference/generated/networkx.generators.community.gaussian_random_partition_graph.html#networkx.generators.community.gaussian_random_partition_graph """ + + from networkx.generators.community import gaussian_random_partition_graph + G = gaussian_random_partition_graph( n=n, s=s, v=v, p_in=p_in, p_out=p_out, directed=directed, seed=seed ) @@ -278,6 +276,8 @@ def PP( .. note:: Reference implementation: https://networkx.org/documentation/stable/reference/generated/networkx.generators.community.planted_partition_graph.html#networkx.generators.community.planted_partition_graph """ + from networkx.generators.community import planted_partition_graph + G = planted_partition_graph( l=l, k=k, p_in=p_in, p_out=p_out, seed=seed, directed=directed ) @@ -329,6 +329,9 @@ def RPG( .. note:: Reference implementation: https://networkx.org/documentation/stable/reference/generated/networkx.generators.community.random_partition_graph.html#networkx.generators.community.random_partition_graph """ + + from networkx.generators.community import random_partition_graph + G = random_partition_graph( sizes=sizes, p_in=p_in, p_out=p_out, seed=seed, directed=directed ) @@ -389,6 +392,9 @@ def SBM( .. note:: Reference implementation: https://networkx.org/documentation/stable/reference/generated/networkx.generators.community.stochastic_block_model.html#networkx.generators.community.stochastic_block_model """ + + from networkx.generators.community import stochastic_block_model + G = stochastic_block_model( sizes=sizes, p=p, diff --git a/cdlib/test/test_dynamic_benchmark.py b/cdlib/test/test_dynamic_benchmark.py index a49ba05f..9d6c0cc5 100644 --- a/cdlib/test/test_dynamic_benchmark.py +++ b/cdlib/test/test_dynamic_benchmark.py @@ -1,7 +1,5 @@ import unittest - import cdlib -from cdlib import algorithms from cdlib import benchmark import dynetx as dn @@ -18,6 +16,3 @@ def test_RDyn(self): cm = coms.get_clustering_at(t) self.assertIsInstance(cm, cdlib.NamedClustering) - -if __name__ == "__main__": - unittest.main() diff --git a/cdlib/test/test_static_benchmark.py b/cdlib/test/test_static_benchmark.py index 22b26a1d..85966e96 100644 --- a/cdlib/test/test_static_benchmark.py +++ b/cdlib/test/test_static_benchmark.py @@ -1,7 +1,6 @@ import unittest import cdlib -from cdlib import algorithms from cdlib import benchmark import networkx as nx @@ -71,6 +70,3 @@ def test_SBM(self): self.assertIsInstance(g, nx.Graph) self.assertIsInstance(coms, cdlib.NodeClustering) - -if __name__ == "__main__": - unittest.main() diff --git a/docs/conf.py b/docs/conf.py index 2d8e790c..8c2c8ef3 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -26,7 +26,6 @@ def __getattr__(cls, name): MOCK_MODULES = [ "dynetx", - "networkx.generators.community", "GraphRicciCurvature.OllivierRicci", "networkx.algorithms", "pycombo", @@ -135,9 +134,9 @@ def __getattr__(cls, name): # built documents. # # The short X.Y version. -version = u"0.2.2" +version = u"0.2.3" # The full version, including alpha/beta/rc tags. -release = u"0.2.2" +release = u"0.2.3" # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. @@ -348,7 +347,7 @@ def __getattr__(cls, name): u"CDlib Documentation", author, "CDlib", - "One line description of project.", + "Community Discovery Library", "Miscellaneous", ), ] diff --git a/docs/reference/benchmark.rst b/docs/reference/benchmark.rst index a41a1f3f..c1ad4fe4 100644 --- a/docs/reference/benchmark.rst +++ b/docs/reference/benchmark.rst @@ -18,10 +18,12 @@ Static Networks with Community Ground Truth Benchmarks for plain static networks. All generators return a tuple: (``networkx.Graph``, ``cdlib.NodeClustering``) + .. automodule:: cdlib.benchmark + .. autosummary:: - :toctree: bench/ + :toctree: eval/ GRP LFR @@ -32,7 +34,7 @@ All generators return a tuple: (``networkx.Graph``, ``cdlib.NodeClustering``) Benchmarks for node-attributed static networks. .. autosummary:: - :toctree: bench/ + :toctree: eval/ XMark @@ -45,7 +47,7 @@ Time evolving network topologies with planted community life-cycles. All generators return a tuple: (``dynetx.DynGraph``, ``cdlib.TemporalClustering``) .. autosummary:: - :toctree: bench/ + :toctree: eval/ RDyn