Skip to content

Commit

Permalink
📝 documentation fix
Browse files Browse the repository at this point in the history
  • Loading branch information
GiulioRossetti committed Aug 30, 2023
1 parent 956b49b commit d081b2e
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 12 deletions.
6 changes: 3 additions & 3 deletions cdlib/algorithms/bipartite_clustering.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def bimlpa(g_original: object, theta: float = 0.3, lambd: int = 7) -> BiNodeClus
>>> from cdlib import algorithms
>>> import networkx as nx
>>> G = nx.algorithms.bipartite.generators.random_graph(100, 20, 0.1)
>>> G = nx.algorithms.bipartite.random_graph(50, 50, 0.25)
>>> coms = algorithms.bimlpa(G)
:References:
Expand Down Expand Up @@ -288,7 +288,7 @@ def condor(g_original: object) -> BiNodeClustering:
========== ======== ======== =========
Undirected Directed Weighted Bipartite
========== ======== ======== =========
Yes No No Yes
Yes No Yes Yes
========== ======== ======== =========
:param g_original: a networkx/igraph object
Expand All @@ -298,7 +298,7 @@ def condor(g_original: object) -> BiNodeClustering:
>>> from cdlib import algorithms
>>> import networkx as nx
>>> G = nx.karate_club_graph()
>>> G = nx.algorithms.bipartite.random_graph(50, 50, 0.25)
>>> coms = algorithms.condor(G)
:References:
Expand Down
8 changes: 4 additions & 4 deletions cdlib/algorithms/crisp_partition.py
Original file line number Diff line number Diff line change
Expand Up @@ -2752,7 +2752,7 @@ def ricci_community(

def spectral(
g_original: object,
kmax: int,
kmax: int = 2,
projection_on_smaller_class: bool = True,
scaler: Callable = None,
) -> NodeClustering:
Expand All @@ -2768,11 +2768,11 @@ def spectral(
========== ======== ======== =========
Undirected Directed Weighted Bipartite
========== ======== ======== =========
Yes No No Yes
Yes No No No
========== ======== ======== =========
:param g_original: a networkx/igraph object
:param kmax: maximum number of desired communities
:param kmax: maximum number of desired communities (mandatory). Default 2.
:param projection_on_smaller_class: a boolean value that if True then it project a bipartite network in the smallest class of node. (default is True)
:param scaler: the function to scale the fielder’s vector to apply KMeans
:return: NodeClustering object
Expand All @@ -2783,7 +2783,7 @@ def spectral(
>>> from cdlib import algorithms
>>> import networkx as nx
>>> G = nx.karate_club_graph()
>>> coms = algorithms.spectral(G)
>>> coms = algorithms.spectral(G, kmax=2)
:References:
Expand Down
1 change: 0 additions & 1 deletion cdlib/algorithms/internal/pycondor.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
raise("This module requires the igraph package. Please install it with pip install python-igraph.")



def condor_object(net):
"""Initialization of the condor object. The function gets a network in edgelist format encoded in a pandas
dataframe. Returns a dictionary with an igraph network, names of the targets and regulators, list of edges,
Expand Down
8 changes: 4 additions & 4 deletions cdlib/test/test_community_discovery_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -653,9 +653,9 @@ def test_belief(self):
self.assertEqual(type(communities.communities[0][0]), int)

def test_CPM_Bipartite(self):
g = ig.Graph.Erdos_Renyi(n=80, m=600)
g.vs["type"] = 0
g.vs[15:]["type"] = 1

g = nx.algorithms.bipartite.random_graph(50, 50, 0.25)

if leidenalg is None:
return
coms = algorithms.CPM_Bipartite(g, 0.3)
Expand Down Expand Up @@ -909,7 +909,7 @@ def test_endntm(self):
def test_scd(self):
G = nx.karate_club_graph()

coms = algorithms.spectral(G, kmax=4)
coms = algorithms.spectral(G, kmax=2)
self.assertEqual(type(coms.communities), list)
if len(coms.communities) > 0:
self.assertEqual(type(coms.communities[0]), list)
Expand Down

0 comments on commit d081b2e

Please sign in to comment.