igraphdata icon indicating copy to clipboard operation
igraphdata copied to clipboard

Python Compatability

Open benyamindsmith opened this issue 9 months ago • 6 comments

Is there a python module for these datasets so that they can be used with the igraph python library?

benyamindsmith avatar Mar 09 '25 03:03 benyamindsmith

There is no Python module, and I'm not sure if it is common practice to create data packages in Python.

You could export these to GraphML and load them in Python.

Generally, the feeling was it would be more useful to focus on packages that can seamlessly download from large online repositories such as https://networks.skewed.de/ instead of creating small data packages. graph-tool can download from this repository and igraph can directly convert from graph-tool.

R/igraph used to have Nexus but it got shut down due to lack of resources to maintain it.

Tagging @ntamas in case he has additional comments.

szhorvat avatar Mar 09 '25 10:03 szhorvat

There is no Python module, and I'm not sure if it is common practice to create data packages in Python.

I think that's correct - maybe inside sub-ecosystems like Anaconda it's more popular, but definitely not in the main PyPI. Having a direct import path from networks.skewed.de would be great, though.

ntamas avatar Mar 09 '25 13:03 ntamas

@benyamindsmith Would you be able to help by checking if all datasets from igraphdata are already on https://networks.skewed.de/ ? If not, we can submit them.

I'm hoping that we can publish a Google Summer of Code project idea for hooking up https://networks.skewed.de/ to igraph (two separate projects for Python and R). I am very constrained on time at the moment, and something we need to figure out in advance is if igraph is currently able to import attributes from https://networks.skewed.de in a usable form. If you have the time and interest, it would useful if you could check this briefly: find a few datasets with non-trivial attribute values, and try to import them into igraph several of the supported formats (GraphML, GML). Does the import work or is it easy to use the attribute values, especially when they're not simply numbers?

szhorvat avatar Mar 10 '25 09:03 szhorvat

@szhorvat

  1. A manual search reveals that the following datasets are not on https://networks.skewed.de/:

  2. I'll try to look into your suggestion r.e. importing data from https://networks.skewed.de/ directly from igraph. That being said it might make more sense to create a repository/package similar to what TidyTuesday did with the tidytuesdayR package which has the user pull the data with the GitHub API.

  3. In terms of other datasets, I did release igraphwalshdata on CRAN, however I do agree that using the "data package" approach is a little dated and a API based approach like how the tidytuesdayR package is structured is preferred.

benyamindsmith avatar Mar 11 '25 00:03 benyamindsmith

One consideration is that several packages, including igraph, interpret certain graph attributes specially to control visualizations (colours, labels, coordinates, etc.) This makes it a bit less convenient to work with a "foreign" data repository that was designed for a different package, or at least makes it desirable to have some sort of auto-conversion or auto-cleanup of attributes when importing to igraph.

szhorvat avatar Mar 11 '25 09:03 szhorvat

Thanks for checking this @benyamindsmith. I'll look at the datasets and will inquire if there's a desire to add them to Netzschleuder.

The Krackhardt kite is available as a "famous graph" built directly into igraph.

szhorvat avatar Mar 11 '25 09:03 szhorvat

1. A manual search reveals that the following datasets **are not** on  https://networks.skewed.de/:
   
   * [Koenigsberg](https://github.com/igraph/igraphdata/blob/main/data/Koenigsberg.rda)
   * [UKfaculty](https://github.com/igraph/igraphdata/blob/main/data/UKfaculty.rda)
   * [USairports](https://github.com/igraph/igraphdata/blob/main/data/USairports.rda)
   * [immuno](https://github.com/igraph/igraphdata/blob/main/data/immuno.rda)
   * [kite](https://github.com/igraph/igraphdata/blob/main/data/kite.rda)

@count0, would you accept these datasets in https://networks.skewed.de/ ? The original source for some of them is no longer accessible, see #8. You can see the data descriptions in these files: https://github.com/igraph/igraphdata/tree/main/R

Would you also accept trivial datasets like Koenigsberg and the Krackhardt kite? The latter is already built into igraph, and the former could be as well. Therefore these are not critical to include. But they may be useful for educational purposes.

Let me know before I go ahead with submitting these.

The idea is to move towards Netzschleuder integration in all igraph interface instead of maintaining such data packages.

szhorvat avatar Apr 27 '25 13:04 szhorvat

Would you also accept trivial datasets like Koenigsberg and the Krackhardt kite? The latter is already built into igraph, and the former could be as well. Therefore these are not critical to include. But they may be useful for educational purposes.

Yes, please go ahead and open an issue upstream!

count0 avatar Apr 27 '25 13:04 count0

  1. A manual search reveals that the following datasets are not on https://networks.skewed.de/:

@benyamindsmith, are you sure that the rest are actually present on Netzschleuder? There are similarly named datasets but they may not be the same things (or a different / newer version of the same thing).

szhorvat avatar Apr 27 '25 16:04 szhorvat

@szhorvat based on the research I did, I believe I did account for this ambiguity.

benyamindsmith avatar Apr 29 '25 00:04 benyamindsmith