graspologic-org / graspologic

Python package for graph statistics

Home Page:https://graspologic-org.github.io/graspologic/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BUG] ValueError in partition.leiden

williamgilpin opened this issue · comments

import graspologic
g = graspologic.simulations.er_np(n=50, p=0.5)
graspologic.partition.leiden(g)

Throws the following ValueError

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
/var/folders/g_/3gcjjjc12l9cjdh8drtctrdm0000gp/T/ipykernel_21002/3698291811.py in <module>
      1 import graspologic
      2 g = graspologic.simulations.er_np(n=50, p=0.5)
----> 3 graspologic.partition.leiden(g)

~/miniconda3/envs/ndyn/lib/python3.8/site-packages/graspologic/partition/leiden.py in leiden(graph, starting_communities, extra_forced_iterations, resolution, randomness, use_modularity, random_seed, weight_attribute, is_weighted, weight_default, check_directed)
    322     )
    323 
--> 324     _improved, _modularity, partitions = gn.leiden(
    325         edges=graph,
    326         starting_communities=starting_communities,

ValueError: not enough values to unpack (expected 3, got 2)

Intriguingly, graspologic.partition.hierarchical_leiden(g) works just fine. Thanks very much for this amazing library, and for any advice. And my regrets if it turns out I'm making a simple error somewhere.

Environment

  • Python: 3.8.11
  • graspologic: 0.2.0
  • graspologic-native: 1.0.0
  • numpy: 1.20.3

It looks like this is fixed if I force an upgrade to the development version 0.3.0 from GitHub:

pip install git+git://github.com/microsoft/graspologic

Thanks again for this amazing library! It's been amazing to work with

glad you got this working @williamgilpin

@daxpryce a few questions related to this:

  1. are we still doing prereleases on pip?
  2. does this look like an issue with graspologic-native somehow?
  3. wondering if we are due for a release (last was May 6th, maybe we should have some kind of schedule for this?)

Just want to make sure we understand what happened with this issue in case others are having it

1: we are
2: it is related, but isn't an issue in native so much as an issue in graspologic itself. we should have released a minor release of graspologic when we made this fix and we didn't. that's on me! basically we're ready for the api change to graspologic native within graspologic, but that doesn't help if we don't publish the version that works with it.
3: we are more than due for a release, we finally have a type hint thing ready to go and now that we have omni lse in place I think we're ready for 0.3. I'll start a thread in the discussion tab and we'll chat about it there. there's an argument to be made that we hold until we do @dlee0156 's changes to autolayout, or we do it now, and release 0.4 as soon as her changes are ready and we've agreed. I'm inclined to release more frequently than less frequently so I don't mind moving ahead with the MSFT changes @ 0.3 and the autolayout enhancements as 0.4, but my guess is 0.3 and 0.4 will be within a few days or weeks of each other based on how close autolayout is. since we have a break in our dependencies right now I think we should release 0.3 like... this week