apcamargo / pyleiden

A CLI tool for clustering with the Leiden algorithm
GNU General Public License v3.0
7 stars 0 forks source link

Output graph to file #1

Open motroy opened 3 months ago

motroy commented 3 months ago

Hi @apcamargo,

Thanks for this excellent tool! This is a small feature request: would it be possible to allow the user to save the graph to file?

Thanks again! Yair

apcamargo commented 3 months ago

Hi @motroy,

That wouldn't be difficult to implement, however I'm not sure what purpose that would have as the input itself already represents the graph (each line is an edge).

motroy commented 2 months ago

Thanks for prompt response @apcamargo! you are right, I was thinking that the graph with the clustering results can be captured in a single file for easier transfer to other tools

apcamargo commented 2 months ago

You're right that the output could be in a more standard format. I need to check if there are any proper format to stogra graph clusters.

motroy commented 2 months ago

That's great, thanks @apcamargo !

I have little experience with graph files, but I managed to export the graph using igraph's write_graphml() method and then imported to another script using the Graph.Read_GraphML() method (https://python.igraph.org/en/0.10.5/tutorial.html#igraph-and-the-outside-world), which then allowed me to access the clusters using the connected_components(mode='strong').membership property of the igraph object also, a colleague was able to view the exported graphml file in the browser via https://ouestware.gitlab.io/retina/1.0.0-beta.1/

Though I'm guessing that there are probably much better ways of doing this, so I don't know if the above helps 😀