sknetwork-team / scikit-network

Graph Algorithms
Other
602 stars 67 forks source link

do you have some where description for bimodularity #560

Closed Sandy4321 closed 1 year ago

Sandy4321 commented 1 year ago

do you have somewhere description for bimodularity per

def test_bimodularity(self):
    biadjacency = star_wars()
    labels_row = np.array([0, 0, 1, 1])
    labels_col = np.array([0, 1, 0])
    self.assertAlmostEqual(get_modularity(biadjacency, labels_row, labels_col), 0.12, 2)

    with self.assertRaises(ValueError):
        get_modularity(biadjacency, labels_row)
    with self.assertRaises(ValueError):
        get_modularity(biadjacency, labels_row[:2], labels_col)
    with self.assertRaises(ValueError):
        get_modularity(biadjacency, labels_row, labels_col[:2])

https://github.com/sknetwork-team/scikit-network/blob/95cec38d56b086b95616d2f1d13a9b98c6c8b534/sknetwork/clustering/tests/test_metrics.py#L39

tbonald commented 1 year ago

Hello,

This function no longer exists. Please use the following function, which is applicable to bipartite graphs as well:

from sknetwork.clustering import get_modularity

Thanks.

Sandy4321 commented 1 year ago

I see, thanks bythe way what is main difference vs networkx? https://pypi.org/project/networkx/

tbonald commented 1 year ago

The main difference is that graphs are stored as sparse matrices (standard scipy format), making scikit-network more scalable. In networkx, graphs are stored as specific objects, including internal node indexing. Most algorithms of scikit-network work well for graphs with (hundreds of) millions of edges.

Sandy4321 commented 1 year ago

great, but do you have new /better algorithms ?

tbonald commented 1 year ago

Yes. See Paris for hierarchical clustering (sknetwork.hierarchy.Paris) or Diffusion for node classification (sknetwork.classification.DiffusionClassifier) for instance.