networkx / nx-parallel

A networkx backend that uses joblib to run graph algorithms in parallel.
BSD 3-Clause "New" or "Revised" License
23 stars 20 forks source link

feat ✨ : Add closeness centrality and floyd warshall feature #72

Open Fre0Grella opened 1 month ago

Fre0Grella commented 1 month ago

Hi, i'm marco, a students from the university of Bologna. For my final project i want to contribute this repository adding the closeness centrality and the floyd warshall algorithms for numpy. The closeness centrality use the newly implemented floyd warshall. The parallelized floyd warshall is a version of tiled FW referenced in the code.

Schefflera-Arboricola commented 1 month ago

@Fre0Grella nx-parallel algorithms receive a ParallelGraph object, so you need to convert it back to the nx.Graph object to run the usual graph object methods on it. That's why you'll see the following lines in all the nx-parallel algorithms

if hasattr(G, "graph_object"):
        G = G.graph_object

Hopefully this will make the tests pass.

Thanks!

Fre0Grella commented 1 month ago

@Schefflera-Arboricola Hi, thanks for the first advice, i hope you could help with this one too. Running the test i got an error that i don't understand; on the closeness.py file, when i use joblib Parallel to call the _closeness_measure function (that from a row of the adjacency matrix get the value of closeness for the node rappresented by the row) i get the error in the joblib code saying TypeError: 'numpy.float64' object is not callable. I tried changing the data format thinking that joblib doesn't support numpy data structure but he kept saying in this case TypeError: 'float' object is not callable.

Schefflera-Arboricola commented 2 weeks ago

Hi @Fre0Grella, Thank you for your contribution :)

Is this PR ready for review? I will aim to get to it as soon as possible, though I cannot provide a specific timeline at the moment. I'm also tagging @dschult in case he would like to review it.

Additionally, could you let us know if there is a deadline for your final project and if this PR needs to be merged before then?

Thank you :)

Fre0Grella commented 2 weeks ago

Hi @Schefflera-Arboricola, the PR is ready for review although i aim to improve the performance further. The dead line of the project is due the 18 of September. I doesn't need the PR to be merged before that