Skip to content

Commit

Permalink
Fix: Remove weird characters and fix no louvain (#91)
Browse files Browse the repository at this point in the history
  • Loading branch information
arnaudon authored Nov 15, 2023
1 parent 041470c commit 783ff73
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 17 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,21 +190,21 @@ If you are interested in trying our other packages, see the below list:

## References

[1] J.-C. Delvenne, S. N. Yaliraki, and M. Barahona, Stability of graph communities across time scales, *Proceedings of the National Academy of Sciences*, vol. 107, no. 29, pp. 12755–12760, Jul. 2010, doi: 10.1073/pnas.0903215107.
[1] J.-C. Delvenne, S. N. Yaliraki, and M. Barahona, 'Stability of graph communities across time scales', *Proceedings of the National Academy of Sciences*, vol. 107, no. 29, pp. 12755–12760, Jul. 2010, doi: 10.1073/pnas.0903215107.

[2] R. Lambiotte, J.-C. Delvenne, and M. Barahona, Random Walks, Markov Processes and the Multiscale Modular Organization of Complex Networks, *IEEE Trans. Netw. Sci. Eng.*, vol. 1, no. 2, pp. 76–90, Jul. 2014, doi: 10.1109/TNSE.2015.2391998.
[2] R. Lambiotte, J.-C. Delvenne, and M. Barahona, 'Random Walks, Markov Processes and the Multiscale Modular Organization of Complex Networks', *IEEE Trans. Netw. Sci. Eng.*, vol. 1, no. 2, pp. 76–90, Jul. 2014, doi: 10.1109/TNSE.2015.2391998.

[3] M. T. Schaub, J.-C. Delvenne, R. Lambiotte, and M. Barahona, Multiscale dynamical embeddings of complex networks, *Phys. Rev. E*, vol. 99, no. 6, Jun. 2019, doi: 10.1103/PhysRevE.99.062308.
[3] M. T. Schaub, J.-C. Delvenne, R. Lambiotte, and M. Barahona, 'Multiscale dynamical embeddings of complex networks', *Phys. Rev. E*, vol. 99, no. 6, Jun. 2019, doi: 10.1103/PhysRevE.99.062308.

[4] V. D. Blondel, J.-L. Guillaume, R. Lambiotte, and E. Lefebvre, Fast unfolding of communities in large networks, *J. Stat. Mech.*, vol. 2008, no. 10, Oct. 2008, doi: 10.1088/1742-5468/2008/10/p10008.
[4] V. D. Blondel, J.-L. Guillaume, R. Lambiotte, and E. Lefebvre, 'Fast unfolding of communities in large networks', *J. Stat. Mech.*, vol. 2008, no. 10, Oct. 2008, doi: 10.1088/1742-5468/2008/10/p10008.

[5] V. A. Traag, L. Waltman, and N. J. van Eck, From Louvain to Leiden: guaranteeing well-connected communities, *Sci Rep*, vol. 9, no. 1, p. 5233, Mar. 2019, doi: 10.1038/s41598-019-41695-z.
[5] V. A. Traag, L. Waltman, and N. J. van Eck, 'From Louvain to Leiden: guaranteeing well-connected communities', *Sci Rep*, vol. 9, no. 1, p. 5233, Mar. 2019, doi: 10.1038/s41598-019-41695-z.

[6] D. J. Schindler, J. Clarke, and M. Barahona, Multiscale Mobility Patterns and the Restriction of Human Movement, *Royal Society Open Science*, vol. 10, no. 10, p. 230405, Oct. 2023, doi: 10.1098/rsos.230405.
[6] D. J. Schindler, J. Clarke, and M. Barahona, 'Multiscale Mobility Patterns and the Restriction of Human Movement', *Royal Society Open Science*, vol. 10, no. 10, p. 230405, Oct. 2023, doi: 10.1098/rsos.230405.

[7] A. Arnaudon, D. J. Schindler, R. L. Peach, A. Gosztolai, M. Hodges, M. T. Schaub, and M. Barahona, PyGenStability: Multiscale community detection with generalized Markov Stability, *arXiv pre-print*, Mar. 2023, doi: 10.48550/arXiv.2303.05385.
[7] A. Arnaudon, D. J. Schindler, R. L. Peach, A. Gosztolai, M. Hodges, M. T. Schaub, and M. Barahona, 'PyGenStability: Multiscale community detection with generalized Markov Stability', *arXiv pre-print*, Mar. 2023, doi: 10.48550/arXiv.2303.05385.

[8] S. Gómez, P. Jensen, and A. Arenas, Analysis of community structure in networks of correlated data. *Physical Review E*, vol. 80, no. 1, p. 016114, Jul. 2009, doi: 10.1103/PhysRevE.80.016114.
[8] S. Gomez, P. Jensen, and A. Arenas, 'Analysis of community structure in networks of correlated data'. *Physical Review E*, vol. 80, no. 1, p. 016114, Jul. 2009, doi: 10.1103/PhysRevE.80.016114.

## Licence

Expand Down
2 changes: 1 addition & 1 deletion extra/lemon/soplex.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ namespace lemon {
///
/// This class implements an interface for the SoPlex LP solver.
/// The SoPlex library is an object oriented lp solver library
/// developed at the Konrad-Zuse-Zentrum für Informationstechnik
/// developed at the Konrad-Zuse-Zentrum fur Informationstechnik
/// Berlin (ZIB). You can find detailed information about it at the
/// <tt>http://soplex.zib.de</tt> address.
class SoplexLp : public LpSolver {
Expand Down
4 changes: 2 additions & 2 deletions src/pygenstability/constructors.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ class constructor_signed_modularity(Constructor):
positive and negative degree vectors.
References:
.. [1] Gómez, S., Jensen, P., & Arenas, A. (2009). Analysis of community structure in
.. [1] Gomez, S., Jensen, P., & Arenas, A. (2009). Analysis of community structure in
networks of correlated data. Physical Review E, 80(1), 016114.
"""

Expand Down Expand Up @@ -309,7 +309,7 @@ def prepare(self, **kwargs):
degrees_abs = np.array(abs(self.graph).sum(1)).flatten()
laplacian = sp.diags(degrees_abs) - self.graph

if self.exp_comp_mode == "spectral":
if self.exp_comp_mode == "spectral": # pragma: no cover
self.spectral_decomp = _compute_spectral_decomp(laplacian)
if self.exp_comp_mode == "expm":
self.partial_quality_matrix = laplacian
Expand Down
4 changes: 2 additions & 2 deletions src/pygenstability/optimal_scales.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ def identify_optimal_scales(results, kernel_size=3, window_size=3, max_nvi=1, ba
result dictionary with two new keys: 'selected_partitions' and 'block_detection_curve'
References:
.. [1] D. J. Schindler, J. Clarke, and M. Barahona, Multiscale Mobility Patterns and
the Restriction of Human Movement, *arXiv:2201.06323*, 2023
.. [1] D. J. Schindler, J. Clarke, and M. Barahona, 'Multiscale Mobility Patterns and
the Restriction of Human Movement', *arXiv:2201.06323*, 2023
"""
# get NVI(t) and NVI(t,t')
nvi_t = np.asarray(results["NVI"])
Expand Down
12 changes: 9 additions & 3 deletions src/pygenstability/pygenstability.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,13 @@
from sklearn.metrics.cluster import entropy
from tqdm import tqdm

from pygenstability import generalized_louvain
try:
from pygenstability import generalized_louvain

_NO_LOUVAIN = False
except ImportError: # pragma: no cover
_NO_LOUVAIN = True

from pygenstability.constructors import load_constructor
from pygenstability.io import save_results
from pygenstability.optimal_scales import identify_optimal_scales
Expand Down Expand Up @@ -108,10 +114,10 @@ def _get_constructor_data(constructor, scales, pool, tqdm_disable=False):


def _check_method(method): # pragma: no cover
if _NO_LEIDEN and not hasattr(generalized_louvain, "evaluate_quality"):
if _NO_LEIDEN and _NO_LOUVAIN:
raise Exception("Without Louvain or Leiden solver, we cannot run PyGenStability")

if method == "louvain" and not hasattr(generalized_louvain, "evaluate_quality"):
if method == "louvain" and _NO_LOUVAIN:
print("Louvain is not available, we fallback to leiden.")
return "leiden"

Expand Down
6 changes: 5 additions & 1 deletion tests/test_constructors.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,11 @@ def test_linearized_directed(graph_directed):

def test_spectral_exp(graph):
"""Test spectral exp computation."""
_skip = ["directed", "linearized_directed"]
_skip = [
"directed",
"linearized_directed",
"signed_combinatorial", # unstable computations on github
]
for constr in CONSTRUCTORS:
if constr not in _skip:
data = _list_data(
Expand Down
2 changes: 2 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ extras = all
commands = pytest -s \
--basetemp={envtmpdir} \
--cov={[base]name} \
--no-cov-on-fail \
--cov-report term-missing \
--cov-fail-under=100

allowlist_externals = make
Expand Down

0 comments on commit 783ff73

Please sign in to comment.