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

Descripency in number of edges between "iterEdges", "forEdges", and "NumberOfEdges" after sparsification #1206

Open
m-eghbali opened this issue Apr 9, 2024 · 1 comment

Comments

@m-eghbali
Copy link

m-eghbali commented Apr 9, 2024

Hi,

I recently started using Networkit. I am working on an example in which I try to sparsify an undirected graph using the following code.

G = nk.GraphFromCoo((edge_coo[0], edge_coo[1]), directed= bool(is_graph_directed) , weighted=False, n=graph.num_nodes)
G.indexEdges()
scansp = nk.sparsification.SCANSparsifier()
scanG = scansp.getSparsifiedGraphOfSize(G, 0.7)

After running this code, the number of edges from scanG.numberOfEdges(), scanG.iterEdges(), and scanG.forEdges() is significantly different.
I was wondering if I'm missing something or if there is a known issue.

Spec:
networkit 11.0
torch 2.0.1
torch-geometric 2.3.1

Thanks

@fabratu
Copy link
Member

fabratu commented Apr 26, 2024

Hi and sry for the late reply. So far, I wasn't able to reproduce your issues. Since your testcase doesn't specify the underlying dataset, I tried the above code with simple graphs, graphs with self loops, self loops + multi edges and directed graphs.

For all these cases (based on generated instances), the output of scanG.numberOfEdges(), scanG.iterEdges(), and scanG.forEdges() is accounting for the same edges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants