Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't visualize subgraph. #1030

Open
joshuak94 opened this issue Feb 1, 2023 · 0 comments
Open

Can't visualize subgraph. #1030

joshuak94 opened this issue Feb 1, 2023 · 0 comments
Labels

Comments

@joshuak94
Copy link

Hello! I came across the following error when trying to visualize a subgraph of a graph with nk.vizbridges.widgetFromGraph(G):

File ~/.local/lib/python3.10/site-packages/networkit/vizbridges.py:188, in widgetFromGraph(G, dimension, nodeScores, nodePartition, nodePalette, showIds, customSize)
    185 hcColors = _calculateNodeColoring(G, palette, nodeScores, nodePartition)
    187 for i in G.iterNodes():
--> 188 	n = ipycytoscape.Node(data={"id": i, "color": hcColors[i] })
    189 	nodes.append(n)
    191 for u,v in G.iterEdges():

IndexError: list index out of range

It worked a bit better when I changed line 187 to for i in range(G.numberOfNodes()) but it still isn't ideal. I assume it has to do with the fact that subgraphs retain the original node indices from the graph, so my subgraph nodes could be indexed with 40, 41, 42, etc..., whereas hcColors might only have 10 options.

@fabratu fabratu added the bug label Mar 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants