NodeClustering methods are failing for "r_spectral_clustering"
Describe the bug NodeClustering methods are failing for "r_spectral_clustering"
To Reproduce Steps to reproduce the behavior:
- CDlib version : cdlib 0.4.0
- Operating System : windows 11
- Python version : 3.11.11
- Version(s) of CDlib required libraries
from cdlib import algorithms import networkx as nx G = nx.karate_club_graph() coms = algorithms.r_spectral_clustering(G, n_clusters=2, method="regularized", percentile=20).size()
Expected behavior A clear and concise description of what you expected to happen. before fix: FitnessResult(min=0, max=0, score=0.0, std=0.0) when working: FitnessResult(min=9, max=22, score=14.9, std=4.109744517606903)
Screenshots If applicable, add screenshots to help explain your problem. before fix:
after fix:
Additional context needs to change "g = convert_graph_formats(g_original, nx.Graph)" to "g = convert_graph_formats(g_original.copy(), nx.Graph)" in source code crisp_partition.py to work
Hi, thanks for opening the issue. If you have time, please consider opening a PR with the fix.
I did the change one layer deeper in convert_graph_formats to return a copy (not a pointer), and sent a PR of the change. It works in my case and I think this change will be a better fix.