alibaba / alibaba/GraphScope

[BUG] Running clustering app on graphscope.nx is slower than networkx over p2p dataset

Open
#2,934 0 comments 0 reactions 0 assignees View on GitHub
component:networkx good first issue performance
Dominant language
C++
Stars
3.6k
Forks
468
Avg merge
29m
Merged PRs (30d)
1

Description

```python
import os
import graphscope.nx as gs_nx
import networkx as nx
import time

start = time.time()
g1 = nx.read_edgelist(
os.path.expandvars('./p2p-31.e'),
nodetype=int,
data=False,
create_using=nx.Graph
)
print(type(g1))
print("networkx = ", time.time() - start)
# networkx.classes.graph.Graph
start = time.time()
g2 = gs_nx.read_edgelist(
os.path.expandvars('./p2p-31.e'),
nodetype=int,
data=False,
create_using=gs_nx.Graph
)
print(type(g2))
print("gs = ", time.time() - start)
start = time.time()
ret_nx = nx.clustering(g1)
print("networkx = ", time.time() - start)
# 0.91s

start = time.time()
ret_gs = gs_nx.clustering(g2)
print("gs = ", time.time() - start)
# 2.12s

# compare the results
print(ret_gs == ret_nx)
```

In addition, [our blog](https://graphscope.io/blog/tech/2023/06/13/Analyzing-Graph-with-GraphScope-in-the-Style-of-NetworkX) shows on Twitter dataset, graphscope.nx is over 25X faster than networkx, but on my testbed, graphscope.nx is only about 7x faster than networkx.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.