Skip to content

Generator doesn't accept networkit.graph.Graph, object is not iterable #1195

@cardin

Description

@cardin

Problem: nk.generators.PowerlawDegreeSequence() doesn't accept Graph as input

Expected: Graph should be an acceptable input to the generator

Environment: Ubuntu 22.04, Python 3.10.13, Networkit 11.0

Conda Env Spec
channels:
  - defaults
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - bzip2=1.0.8=h5eee18b_5
  - ca-certificates=2024.3.11=h06a4308_0
  - ld_impl_linux-64=2.38=h1181459_1
  - libffi=3.4.4=h6a678d5_0
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - libuuid=1.41.5=h5eee18b_0
  - ncurses=6.4=h6a678d5_0
  - openssl=3.0.13=h7f8727e_0
  - pip=23.3.1=py310h06a4308_0
  - python=3.10.13=h955ad1f_0
  - readline=8.2=h5eee18b_0
  - setuptools=68.2.2=py310h06a4308_0
  - sqlite=3.41.2=h5eee18b_0
  - tk=8.6.12=h1ccaba5_0
  - tzdata=2024a=h04d1e81_0
  - wheel=0.41.2=py310h06a4308_0
  - xz=5.4.6=h5eee18b_0
  - zlib=1.2.13=h5eee18b_0
  - pip:
      - astroid==3.1.0
      - coverage==7.4.4
      - dill==0.3.8
      - exceptiongroup==1.2.0
      - iniconfig==2.0.0
      - isort==5.13.2
      - mccabe==0.7.0
      - networkit==11.0
      - networkx==2.8.8
      - numpy==1.26.4
      - packaging==24.0
      - pandas==1.5.3
      - pluggy==1.4.0
      - pydocstyle==6.3.0
      - pylint==3.1.0
      - pytest==8.1.1
      - pytest-cov==4.1.0
      - python-dateutil==2.9.0.post0
      - pytz==2024.1
      - scipy==1.12.0
      - six==1.16.0
      - snowballstemmer==2.2.0
      - tomli==2.0.1
      - tomlkit==0.12.4
      - tqdm==4.66.2
      - typing-extensions==4.10.0

Replication Code:

import networkit as nk

n, k = 100, 10
pIntra, pInter = 0.1, 0.05
gen = nk.generators.ClusteredRandomGraphGenerator(n, k, pIntra, pInter)
G = gen.generate()
generators = nk.generators.PowerlawDegreeSequence(G)

Error Message:

Traceback (most recent call last):
  File "networkit/generators.pyx", line 657, in networkit.generators.PowerlawDegreeSequence.__cinit__
  File "<stringsource>", line 47, in vector.from_py.__pyx_convert_vector_from_py_double
TypeError: 'networkit.graph.Graph' object is not iterable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/project/test.py", line 7, in <module>
    generators = nk.generators.PowerlawDegreeSequence(G)
  File "networkit/generators.pyx", line 659, in networkit.generators.PowerlawDegreeSequence.__cinit__
TypeError: an integer is required

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions