Skip to content

num_nodes parameters of Graph.from_edge_list leads to index error #263

Description

@koaladomi

Creating a graph with the Graph.from_edge_list function with a parameter num_nodes that is higher than the number of nodes specified with the edge list, leads into an index error. But it's not the initialization that fails.
See a minimal example here:
g = pp.Graph.from_edge_list([("a","b"), ("a","c")], num_nodes=5).to_undirected()
print(f"Number of nodes: {g.N}")
for v in g.nodes:
print(v)
Number of nodes are printed out right, but referencing each node won't work anymore. This throws an IndexError:

IndexError: index 3 is out of bounds for axis 0 with size 3

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions