-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
⬆️ support for python-infomap>=1.7.1
- Loading branch information
1 parent
6df619e
commit 04fb848
Showing
2 changed files
with
10 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
04fb848
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this related to this commit? mapequation/infomap@e30870f
Did it break on your end or are you leveraging the new API?
04fb848
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, the issue is due to a misalignment of pypi and conda versions for infomap.
The pypi version (the last time I checked) was aligned to the commit you linked, the conda not yet.
04fb848
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another comment. For the Infomap algorithm, you create a new graph with the nodes relabeled using consecutive integers.
As Infomap 1.x supports non-consecutive integers, you may skip this step if the node types are ints to save some performance on the marginal. However, in that case, you can't generate node ids with
enumerate
as above, as those ids may not match the edges, but if you already have integer ids, it should work to add the nodes directly.For string types, you can maybe use that method, or avoid it by remapping nodes and edges as you add them, which Infomap does in the add_networkx_graph method. You can use that method directly also to simplify these steps.
04fb848
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, yet another comment :)
The
int(imp.__version__.replace(".", ""))
code to check version is a bit dangerous. If we had for example a version 1.6.10, which is less than 1.7.1 for semantic versioning, you would get 1610 which is larger than 171.There are methods in setuptools or packaging that you can use (from stackoverflow).
--Edit--
Tip from @antoneri, tuples of ints have correct comparisons where
(1.6.10) < (1.7.1)
. So an alternative may be to check iftuple(map(int, infomap.__version__. split("."))) >= (1,7,1)
.