Skip to content

Commit

Permalink
📝 mock
Browse files Browse the repository at this point in the history
  • Loading branch information
GiulioRossetti committed Jul 13, 2021
1 parent 0142594 commit ca8809f
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 23 deletions.
20 changes: 13 additions & 7 deletions cdlib/benchmark/static_benchmark.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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
)
Expand Down Expand Up @@ -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
)
Expand Down Expand Up @@ -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
)
Expand Down Expand Up @@ -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,
Expand Down
5 changes: 0 additions & 5 deletions cdlib/test/test_dynamic_benchmark.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import unittest

import cdlib
from cdlib import algorithms
from cdlib import benchmark
import dynetx as dn

Expand All @@ -18,6 +16,3 @@ def test_RDyn(self):
cm = coms.get_clustering_at(t)
self.assertIsInstance(cm, cdlib.NamedClustering)


if __name__ == "__main__":
unittest.main()
4 changes: 0 additions & 4 deletions cdlib/test/test_static_benchmark.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import unittest

import cdlib
from cdlib import algorithms
from cdlib import benchmark
import networkx as nx

Expand Down Expand Up @@ -71,6 +70,3 @@ def test_SBM(self):
self.assertIsInstance(g, nx.Graph)
self.assertIsInstance(coms, cdlib.NodeClustering)


if __name__ == "__main__":
unittest.main()
7 changes: 3 additions & 4 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ def __getattr__(cls, name):

MOCK_MODULES = [
"dynetx",
"networkx.generators.community",
"GraphRicciCurvature.OllivierRicci",
"networkx.algorithms",
"pycombo",
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -348,7 +347,7 @@ def __getattr__(cls, name):
u"CDlib Documentation",
author,
"CDlib",
"One line description of project.",
"Community Discovery Library",
"Miscellaneous",
),
]
Expand Down
8 changes: 5 additions & 3 deletions docs/reference/benchmark.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand All @@ -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

Expand Down

0 comments on commit ca8809f

Please sign in to comment.