Skill Tracer
Skills › Scientific Agent Skills › optimize-for-gpu › cugraph.md

cugraph.md

752 lines · skills/optimize-for-gpu/references/cugraph.md at 5f2bc03

Open on GitHub

Most marks come from matching words in the file, so treat them as pointers.

1# cuGraph Reference
2
3> Review: 2026-10-01. Code below is illustrative unless explicitly described as CPU-tested.
4> GPU execution, performance, GDS, and multi-GPU behavior require validation on target hardware.
5
6cuGraph is NVIDIA's GPU-accelerated graph analytics library within the RAPIDS ecosystem. It
7supports both a direct Python API and an **nx-cugraph** NetworkX backend. Performance depends on
8algorithm, graph topology and size, graph-construction cost, fallback behavior, and GPU hardware,
9so benchmark the complete workload instead of promising a fixed speedup.
11> **Full documentation:** https://docs.nvidia.com/cugraph/26.08/
12> **Version target:** 26.08
13> **Repository:** https://github.com/rapidsai/cugraph

cuGraph Reference

Review: 2026-10-01. Code below is illustrative unless explicitly described as CPU-tested. GPU execution, performance, GDS, and multi-GPU behavior require validation on target hardware.

cuGraph is NVIDIA's GPU-accelerated graph analytics library within the RAPIDS ecosystem. It supports both a direct Python API and an nx-cugraph NetworkX backend. Performance depends on algorithm, graph topology and size, graph-construction cost, fallback behavior, and GPU hardware, so benchmark the complete workload instead of promising a fixed speedup.

Full documentation: https://docs.nvidia.com/cugraph/26.08/ Version target: 26.08 Repository: https://github.com/rapidsai/cugraph
Raw lines 1 to 14
15## Table of Contents
171. [Installation and Setup](#installation-and-setup)
182. [Two Usage Modes](#two-usage-modes)
193. [nx-cugraph: Zero-Code-Change NetworkX Backend](#nx-cugraph-zero-code-change-networkx-backend)
204. [Direct cuGraph API](#direct-cugraph-api)
215. [Graph Creation and Data Loading](#graph-creation-and-data-loading)
226. [Supported Graph Types](#supported-graph-types)
237. [Algorithm Catalog](#algorithm-catalog)
248. [Multi-GPU Support with Dask](#multi-gpu-support-with-dask)
259. [GNN Support (cugraph-pyg and WholeGraph)](#gnn-support)
2610. [Performance Characteristics and Benchmarks](#performance-characteristics-and-benchmarks)
2711. [Memory Management](#memory-management)
2812. [Interoperability](#interoperability)
2913. [Known Limitations vs NetworkX](#known-limitations-vs-networkx)
3014. [Common Migration Patterns](#common-migration-patterns)
32---

Table of Contents

  1. Installation and Setup
  2. Two Usage Modes
  3. nx-cugraph: Zero-Code-Change NetworkX Backend
  4. Direct cuGraph API
  5. Graph Creation and Data Loading
  6. Supported Graph Types
  7. Algorithm Catalog
  8. Multi-GPU Support with Dask
  9. GNN Support (cugraph-pyg and WholeGraph)
  10. Performance Characteristics and Benchmarks
  11. Memory Management
  12. Interoperability
  13. Known Limitations vs NetworkX
  14. Common Migration Patterns

Raw lines 15 to 33
34## Installation and Setup
36Use `uv add` in standalone examples; follow the user's existing project package manager when one
37is already configured.
39```bash
40uv add --extra-index-url=https://pypi.nvidia.com "cugraph-cu12==26.8.*" # Core cuGraph for CUDA 12.x
41uv add --extra-index-url=https://pypi.nvidia.com "nx-cugraph-cu12==26.8.*" # NetworkX backend
42# For CUDA 13.x, use the -cu13 packages: cugraph-cu13, nx-cugraph-cu13
43```
4526.08 cuGraph and nx-cugraph wheels are published on PyPI. The NVIDIA index is optional for these current packages; historical releases may still use stub distributions.
47**Platform:** Linux and WSL2 only (no native macOS or Windows).
48**Requires:** Python >= 3.11, NVIDIA GPU with CUDA 12.x or 13.x support, NetworkX >= 3.2 (>= 3.5 recommended for optimal nx-cugraph).
50Verify:
51```python
52import cugraph
53print(cugraph.__version__)
55# Quick test with built-in dataset
56from cugraph.datasets import karate
57G = karate.get_graph()
58result = cugraph.degree_centrality(G)
59print(result.head())
60```
62---

Installation and Setup

Use uv add in standalone examples; follow the user's existing project package manager when one is already configured.

uv add --extra-index-url=https://pypi.nvidia.com "cugraph-cu12==26.8.*"    # Core cuGraph for CUDA 12.x
uv add --extra-index-url=https://pypi.nvidia.com "nx-cugraph-cu12==26.8.*" # NetworkX backend
# For CUDA 13.x, use the -cu13 packages: cugraph-cu13, nx-cugraph-cu13

26.08 cuGraph and nx-cugraph wheels are published on PyPI. The NVIDIA index is optional for these current packages; historical releases may still use stub distributions.

Platform: Linux and WSL2 only (no native macOS or Windows). Requires: Python >= 3.11, NVIDIA GPU with CUDA 12.x or 13.x support, NetworkX >= 3.2 (>= 3.5 recommended for optimal nx-cugraph).

Verify:

import cugraph
print(cugraph.__version__)

# Quick test with built-in dataset
from cugraph.datasets import karate
G = karate.get_graph()
result = cugraph.degree_centrality(G)
print(result.head())

Raw lines 34 to 63
64## Two Usage Modes

Two Usage Modes

Raw lines 64 to 65
66### Mode 1: nx-cugraph Backend (Zero Code Change)
67Accelerate existing NetworkX code by setting one environment variable. No code changes required.
69```bash
70NX_CUGRAPH_AUTOCONFIG=True python my_networkx_script.py
71```

Mode 1: nx-cugraph Backend (Zero Code Change)

Accelerate existing NetworkX code by setting one environment variable. No code changes required.

NX_CUGRAPH_AUTOCONFIG=True python my_networkx_script.py
Raw lines 66 to 72
Runs code python my_networkx_script.py :70
73### Mode 2: Direct cuGraph API
74Use cuGraph's native API for maximum control, working directly with cuDF DataFrames and cuGraph graph objects.
76```python
77import cugraph
78import cudf
80edges = cudf.DataFrame({
81 "src": [0, 1, 2, 0],
82 "dst": [1, 2, 3, 3],
83 "weight": [1.0, 2.0, 1.5, 3.0]
84})
85G = cugraph.Graph()
86G.from_cudf_edgelist(edges, source="src", destination="dst", edge_attr="weight")
87result = cugraph.pagerank(G)
88```
90**When to use which:**
91- **nx-cugraph**: Existing NetworkX codebases, rapid prototyping, when you want zero migration effort
92- **Direct API**: Maximum performance, multi-GPU workflows, integration with cuDF/cuML pipelines, GNN training
94---

Mode 2: Direct cuGraph API

Use cuGraph's native API for maximum control, working directly with cuDF DataFrames and cuGraph graph objects.

import cugraph
import cudf

edges = cudf.DataFrame({
    "src": [0, 1, 2, 0],
    "dst": [1, 2, 3, 3],
    "weight": [1.0, 2.0, 1.5, 3.0]
})
G = cugraph.Graph()
G.from_cudf_edgelist(edges, source="src", destination="dst", edge_attr="weight")
result = cugraph.pagerank(G)

When to use which:

  • nx-cugraph: Existing NetworkX codebases, rapid prototyping, when you want zero migration effort
  • Direct API: Maximum performance, multi-GPU workflows, integration with cuDF/cuML pipelines, GNN training

Raw lines 73 to 95
96## nx-cugraph: Zero-Code-Change NetworkX Backend
98nx-cugraph is a NetworkX backend that transparently redirects supported algorithm calls to GPU-accelerated cuGraph implementations.

nx-cugraph: Zero-Code-Change NetworkX Backend

nx-cugraph is a NetworkX backend that transparently redirects supported algorithm calls to GPU-accelerated cuGraph implementations.

Raw lines 96 to 99
100### How It Works
102NetworkX >= 3.2 has a backend dispatch system. When nx-cugraph is installed and enabled, NetworkX automatically redirects supported function calls to GPU implementations. Unsupported calls fall back to default NetworkX.

How It Works

NetworkX >= 3.2 has a backend dispatch system. When nx-cugraph is installed and enabled, NetworkX automatically redirects supported function calls to GPU implementations. Unsupported calls fall back to default NetworkX.

Raw lines 100 to 103
Starts an agent dispatch :102
104### Three Ways to Enable
106**1. Environment Variable (recommended for zero code change):**
107```bash
108export NX_CUGRAPH_AUTOCONFIG=True
109python my_script.py
110# OR inline:
111NX_CUGRAPH_AUTOCONFIG=True python my_script.py
112```
114**2. Keyword Argument (explicit per-call):**
115```python
116import networkx as nx
117result = nx.betweenness_centrality(G, k=10, backend="cugraph")
118```
120**3. Type-Based Dispatch (explicit graph conversion):**
121```python
122import networkx as nx
123import nx_cugraph as nxcg
125G_nx = nx.karate_club_graph()
126G_gpu = nxcg.from_networkx(G_nx) # Convert once, reuse for multiple algorithms
127result = nx.pagerank(G_gpu) # Automatically dispatched to GPU
128```
130Since 26.04, GPU-backed graphs can also be constructed directly, e.g. `nx.Graph(backend="cugraph")`.

Three Ways to Enable

1. Environment Variable (recommended for zero code change):

export NX_CUGRAPH_AUTOCONFIG=True
python my_script.py
# OR inline:
NX_CUGRAPH_AUTOCONFIG=True python my_script.py

2. Keyword Argument (explicit per-call):

import networkx as nx
result = nx.betweenness_centrality(G, k=10, backend="cugraph")

3. Type-Based Dispatch (explicit graph conversion):

import networkx as nx
import nx_cugraph as nxcg

G_nx = nx.karate_club_graph()
G_gpu = nxcg.from_networkx(G_nx)  # Convert once, reuse for multiple algorithms
result = nx.pagerank(G_gpu)       # Automatically dispatched to GPU

Since 26.04, GPU-backed graphs can also be constructed directly, e.g. nx.Graph(backend="cugraph").

Raw lines 104 to 131
Runs code python my_script.py :109
Starts an agent Dispatch :120
Starts an agent dispatched :127
132### Supported Algorithms in nx-cugraph
134**Centrality:**
135- `betweenness_centrality`, `edge_betweenness_centrality`
136- `degree_centrality`, `in_degree_centrality`, `out_degree_centrality`
137- `eigenvector_centrality`, `katz_centrality`
139**Community:**
140- `louvain_communities`, `leiden_communities`
142**Components:**
143- `connected_components`, `is_connected`, `number_connected_components`
144- `node_connected_component`
145- `weakly_connected_components`, `is_weakly_connected`, `number_weakly_connected_components`
147**Clustering:**
148- `average_clustering`, `clustering`, `transitivity`, `triangles`
150**Core:**
151- `core_number`, `k_truss`
153**Link Analysis:**
154- `pagerank`, `hits`
156**Link Prediction:**
157- `jaccard_coefficient`
159**Shortest Paths (23+ functions):**
160- `shortest_path`, `shortest_path_length`
161- `has_path`, `all_pairs_shortest_path`, `all_pairs_shortest_path_length`
162- `dijkstra_path`, `dijkstra_path_length`, `all_pairs_dijkstra`, `all_pairs_dijkstra_path_length`
163- `bellman_ford_path`, `bellman_ford_path_length`, `all_pairs_bellman_ford_path_length`
164- `single_source_shortest_path`, `single_source_shortest_path_length`
165- `single_source_dijkstra`, `single_source_dijkstra_path`, `single_source_dijkstra_path_length`
166- `single_source_bellman_ford`, `single_source_bellman_ford_path`, `single_source_bellman_ford_path_length`
167- `single_target_shortest_path_length`
169**Traversal:**
170- `bfs_edges`, `bfs_layers`, `bfs_predecessors`, `bfs_successors`, `bfs_tree`
171- `generic_bfs_edges`, `descendants_at_distance`
173**DAG:**
174- `ancestors`, `descendants`
176**Bipartite:**
177- `betweenness_centrality` (bipartite), `biadjacency_matrix`
178- `complete_bipartite_graph`, `from_biadjacency_matrix`
180**Tree:**
181- `is_arborescence`, `is_branching`, `is_forest`, `is_tree`
183**Operators:**
184- `complement`, `reverse`
186**Reciprocity:**
187- `overall_reciprocity`, `reciprocity`
189**Isolate:**
190- `is_isolate`, `isolates`, `number_of_isolates`
192**Lowest Common Ancestors:**
193- `lowest_common_ancestor`
195**Layout:**
196- `forceatlas2_layout`
198**Graph Generators:** Various generators are also supported for creating graphs directly on GPU.
200---

Supported Algorithms in nx-cugraph

Centrality:

  • betweenness_centrality, edge_betweenness_centrality
  • degree_centrality, in_degree_centrality, out_degree_centrality
  • eigenvector_centrality, katz_centrality

Community:

  • louvain_communities, leiden_communities

Components:

  • connected_components, is_connected, number_connected_components
  • node_connected_component
  • weakly_connected_components, is_weakly_connected, number_weakly_connected_components

Clustering:

  • average_clustering, clustering, transitivity, triangles

Core:

  • core_number, k_truss

Link Analysis:

  • pagerank, hits

Link Prediction:

  • jaccard_coefficient

Shortest Paths (23+ functions):

  • shortest_path, shortest_path_length
  • has_path, all_pairs_shortest_path, all_pairs_shortest_path_length
  • dijkstra_path, dijkstra_path_length, all_pairs_dijkstra, all_pairs_dijkstra_path_length
  • bellman_ford_path, bellman_ford_path_length, all_pairs_bellman_ford_path_length
  • single_source_shortest_path, single_source_shortest_path_length
  • single_source_dijkstra, single_source_dijkstra_path, single_source_dijkstra_path_length
  • single_source_bellman_ford, single_source_bellman_ford_path, single_source_bellman_ford_path_length
  • single_target_shortest_path_length

Traversal:

  • bfs_edges, bfs_layers, bfs_predecessors, bfs_successors, bfs_tree
  • generic_bfs_edges, descendants_at_distance

DAG:

  • ancestors, descendants

Bipartite:

  • betweenness_centrality (bipartite), biadjacency_matrix
  • complete_bipartite_graph, from_biadjacency_matrix

Tree:

  • is_arborescence, is_branching, is_forest, is_tree

Operators:

  • complement, reverse

Reciprocity:

  • overall_reciprocity, reciprocity

Isolate:

  • is_isolate, isolates, number_of_isolates

Lowest Common Ancestors:

  • lowest_common_ancestor

Layout:

  • forceatlas2_layout

Graph Generators: Various generators are also supported for creating graphs directly on GPU.


Raw lines 132 to 201
202## Direct cuGraph API

Direct cuGraph API

Raw lines 202 to 203
204### Quick Example
206```python
207import cugraph
208import cudf
210# Load edges from cuDF DataFrame
211edges = cudf.DataFrame({
212 "source": [0, 1, 2, 3, 0, 2],
213 "destination": [1, 2, 3, 4, 4, 1],
214 "weight": [1.0, 2.0, 1.0, 3.0, 0.5, 1.5]
215})
217G = cugraph.Graph(directed=True)
218G.from_cudf_edgelist(edges, source="source", destination="destination", edge_attr="weight")
220# Run algorithms
221pr = cugraph.pagerank(G)
222bc = cugraph.betweenness_centrality(G)
223components = cugraph.weakly_connected_components(G)
224```
226---

Quick Example

import cugraph
import cudf

# Load edges from cuDF DataFrame
edges = cudf.DataFrame({
    "source": [0, 1, 2, 3, 0, 2],
    "destination": [1, 2, 3, 4, 4, 1],
    "weight": [1.0, 2.0, 1.0, 3.0, 0.5, 1.5]
})

G = cugraph.Graph(directed=True)
G.from_cudf_edgelist(edges, source="source", destination="destination", edge_attr="weight")

# Run algorithms
pr = cugraph.pagerank(G)
bc = cugraph.betweenness_centrality(G)
components = cugraph.weakly_connected_components(G)

Raw lines 204 to 227
228## Graph Creation and Data Loading

Graph Creation and Data Loading

Raw lines 228 to 229
230### From cuDF DataFrame (Primary Method)
231```python
232import cudf, cugraph
234df = cudf.DataFrame({"src": [0, 1, 2], "dst": [1, 2, 3], "wt": [1.0, 2.0, 3.0]})
236# Unweighted
237G = cugraph.Graph()
238G.from_cudf_edgelist(df, source="src", destination="dst")
240# Weighted
241G = cugraph.Graph()
242G.from_cudf_edgelist(df, source="src", destination="dst", edge_attr="wt")
244# Directed
245G = cugraph.Graph(directed=True)
246G.from_cudf_edgelist(df, source="src", destination="dst")
247```

From cuDF DataFrame (Primary Method)

import cudf, cugraph

df = cudf.DataFrame({"src": [0, 1, 2], "dst": [1, 2, 3], "wt": [1.0, 2.0, 3.0]})

# Unweighted
G = cugraph.Graph()
G.from_cudf_edgelist(df, source="src", destination="dst")

# Weighted
G = cugraph.Graph()
G.from_cudf_edgelist(df, source="src", destination="dst", edge_attr="wt")

# Directed
G = cugraph.Graph(directed=True)
G.from_cudf_edgelist(df, source="src", destination="dst")
Raw lines 230 to 248
249### From Pandas DataFrame
250```python
251import pandas as pd, cugraph
253df = pd.DataFrame({"src": [0, 1, 2], "dst": [1, 2, 3]})
254G = cugraph.Graph()
255G.from_pandas_edgelist(df, source="src", destination="dst")
256```

From Pandas DataFrame

import pandas as pd, cugraph

df = pd.DataFrame({"src": [0, 1, 2], "dst": [1, 2, 3]})
G = cugraph.Graph()
G.from_pandas_edgelist(df, source="src", destination="dst")
Raw lines 249 to 257
258### From cuDF Adjacency List
259```python
260G = cugraph.Graph()
261G.from_cudf_adjlist(offsets, indices, values) # CSR format
262```

From cuDF Adjacency List

G = cugraph.Graph()
G.from_cudf_adjlist(offsets, indices, values)  # CSR format
Raw lines 258 to 263
264### From NumPy Array
265```python
266import numpy as np
267adj_matrix = np.array([[0, 1, 0], [1, 0, 1], [0, 1, 0]])
268G = cugraph.Graph()
269G.from_numpy_array(adj_matrix)
270```

From NumPy Array

import numpy as np
adj_matrix = np.array([[0, 1, 0], [1, 0, 1], [0, 1, 0]])
G = cugraph.Graph()
G.from_numpy_array(adj_matrix)
Raw lines 264 to 271
272### From Pandas Adjacency Matrix
273```python
274G = cugraph.Graph()
275G.from_pandas_adjacency(adj_df)
276```

From Pandas Adjacency Matrix

G = cugraph.Graph()
G.from_pandas_adjacency(adj_df)
Raw lines 272 to 277
278### From Dask-cuDF (Multi-GPU)
279```python
280G = cugraph.Graph()
281G.from_dask_cudf_edgelist(dask_cudf_df, source="src", destination="dst")
282```

From Dask-cuDF (Multi-GPU)

G = cugraph.Graph()
G.from_dask_cudf_edgelist(dask_cudf_df, source="src", destination="dst")
Raw lines 278 to 283
284### From Built-in Datasets
285```python
286from cugraph.datasets import karate, dolphins, polbooks, netscience
287G = karate.get_graph()
288```

From Built-in Datasets

from cugraph.datasets import karate, dolphins, polbooks, netscience
G = karate.get_graph()
Raw lines 284 to 289
290### Symmetrization (Undirected Graphs)
291```python
292# Ensure all edges are bidirectional
293sym_df = cugraph.symmetrize_df(df, "src", "dst")
295# Or symmetrize a graph directly
296sym_df = cugraph.symmetrize(source_col, dest_col, weight_col)
297```

Symmetrization (Undirected Graphs)

# Ensure all edges are bidirectional
sym_df = cugraph.symmetrize_df(df, "src", "dst")

# Or symmetrize a graph directly
sym_df = cugraph.symmetrize(source_col, dest_col, weight_col)
Raw lines 290 to 298
299### Vertex Renumbering
300cuGraph internally renumbers vertices to contiguous integers starting from 0. Native high-level algorithms such as PageRank already restore external IDs. Do not unrenumber those results twice:
301```python
302result = cugraph.pagerank(G)
303# Use G.unrenumber only for an explicitly internal-ID table from a lower-level API.
304```
306---

Vertex Renumbering

cuGraph internally renumbers vertices to contiguous integers starting from 0. Native high-level algorithms such as PageRank already restore external IDs. Do not unrenumber those results twice:

result = cugraph.pagerank(G)
# Use G.unrenumber only for an explicitly internal-ID table from a lower-level API.

Raw lines 299 to 307
308## Supported Graph Types
310| Graph Type | cuGraph Class | Notes |
311|---|---|---|
312| **Undirected** | `cugraph.Graph()` | Default; edges are bidirectional |
313| **Directed** | `cugraph.Graph(directed=True)` | Directed edges; some algorithms require directed/undirected |
314| **Weighted** | Set `edge_attr` in `from_cudf_edgelist` | Edge weights used by SSSP, PageRank, Louvain, etc. |
315| **MultiGraph** | `cugraph.MultiGraph()` | Multiple edges between same vertex pairs |
316| **Bipartite** | Represent bipartite structure in a standard Graph | Check nx-cugraph for supported NetworkX bipartite operations |
318**Important:** cuGraph uses a CSR (Compressed Sparse Row) internal representation. Graphs are immutable after creation -- you cannot dynamically add/remove individual edges after calling `from_cudf_edgelist()`. To modify a graph, reconstruct it from a new DataFrame.
320---

Supported Graph Types

Graph TypecuGraph ClassNotes
Undirectedcugraph.Graph()Default; edges are bidirectional
Directedcugraph.Graph(directed=True)Directed edges; some algorithms require directed/undirected
WeightedSet edge_attr in from_cudf_edgelistEdge weights used by SSSP, PageRank, Louvain, etc.
MultiGraphcugraph.MultiGraph()Multiple edges between same vertex pairs
BipartiteRepresent bipartite structure in a standard GraphCheck nx-cugraph for supported NetworkX bipartite operations

Important: cuGraph uses a CSR (Compressed Sparse Row) internal representation. Graphs are immutable after creation -- you cannot dynamically add/remove individual edges after calling from_cudf_edgelist(). To modify a graph, reconstruct it from a new DataFrame.


Raw lines 308 to 321
322## Algorithm Catalog
324The multi-GPU column uses callable aliases exported by `import cugraph.dask`.
325Namespace subpackages may instead expose modules or single-GPU imports; do not
326construct an API path by inserting `centrality`, `community`, or `components`.
327Column entries identify APIs, not interchangeable return schemas or weight support.

Algorithm Catalog

The multi-GPU column uses callable aliases exported by import cugraph.dask. Namespace subpackages may instead expose modules or single-GPU imports; do not construct an API path by inserting centrality, community, or components. Column entries identify APIs, not interchangeable return schemas or weight support.

Raw lines 322 to 328
329### Centrality
331| Algorithm | Single-GPU | Multi-GPU | NetworkX Equivalent |
332|---|---|---|---|
333| Betweenness Centrality | `cugraph.betweenness_centrality(G)` | `cugraph.dask.betweenness_centrality()` | `nx.betweenness_centrality()` |
334| Edge Betweenness | `cugraph.edge_betweenness_centrality(G)` | `cugraph.dask.edge_betweenness_centrality()` | `nx.edge_betweenness_centrality()` |
335| Degree Centrality | `cugraph.degree_centrality(G)` | -- | `nx.degree_centrality()` |
336| Eigenvector Centrality | `cugraph.eigenvector_centrality(G)` | `cugraph.dask.eigenvector_centrality()` | `nx.eigenvector_centrality()` |
337| Katz Centrality | `cugraph.katz_centrality(G)` | `cugraph.dask.katz_centrality()` | `nx.katz_centrality()` |

Centrality

AlgorithmSingle-GPUMulti-GPUNetworkX Equivalent
Betweenness Centralitycugraph.betweenness_centrality(G)cugraph.dask.betweenness_centrality()nx.betweenness_centrality()
Edge Betweennesscugraph.edge_betweenness_centrality(G)cugraph.dask.edge_betweenness_centrality()nx.edge_betweenness_centrality()
Degree Centralitycugraph.degree_centrality(G)--nx.degree_centrality()
Eigenvector Centralitycugraph.eigenvector_centrality(G)cugraph.dask.eigenvector_centrality()nx.eigenvector_centrality()
Katz Centralitycugraph.katz_centrality(G)cugraph.dask.katz_centrality()nx.katz_centrality()
Raw lines 329 to 338
339### Community Detection
341| Algorithm | Single-GPU | Multi-GPU | NetworkX Equivalent |
342|---|---|---|---|
343| Louvain | `cugraph.louvain(G, max_level=, max_iter=, resolution=)` | `cugraph.dask.louvain()` | `nx.community.louvain_communities()` |
344| Leiden | `cugraph.leiden(G, max_iter=, resolution=)` | `cugraph.dask.leiden()` | `nx.community.leiden_communities()` |
345| ECG | `cugraph.ecg(G, min_weight=)` | `cugraph.dask.ecg()` | -- |
346| Spectral Balanced Cut | `cugraph.spectralBalancedCutClustering(G, num_clusters)` | -- | -- |
347| Spectral Modularity | `cugraph.spectralModularityMaximizationClustering(G, num_clusters)` | -- | -- |
348| Triangle Counting | `cugraph.triangle_count(G)` | `cugraph.dask.triangle_count()` | `nx.triangles()` |
349| K-Truss | `cugraph.k_truss(G, k)` or `cugraph.ktruss_subgraph(G, k)` | `cugraph.dask.ktruss_subgraph()` | `nx.k_truss()` |
350| EgoNet | `cugraph.ego_graph(G, n, radius=)` | `cugraph.dask.ego_graph()` | `nx.ego_graph()` |
351| Induced Subgraph | `cugraph.induced_subgraph(G, vertices)` | `cugraph.dask.induced_subgraph()` | `G.subgraph(vertices)` |
353**Clustering Analysis:**
354- `cugraph.analyzeClustering_edge_cut(G, n_clusters, clustering)`
355- `cugraph.analyzeClustering_modularity(G, n_clusters, clustering)`
356- `cugraph.analyzeClustering_ratio_cut(G, n_clusters, clustering)`

Community Detection

AlgorithmSingle-GPUMulti-GPUNetworkX Equivalent
Louvaincugraph.louvain(G, max_level=, max_iter=, resolution=)cugraph.dask.louvain()nx.community.louvain_communities()
Leidencugraph.leiden(G, max_iter=, resolution=)cugraph.dask.leiden()nx.community.leiden_communities()
ECGcugraph.ecg(G, min_weight=)cugraph.dask.ecg()--
Spectral Balanced Cutcugraph.spectralBalancedCutClustering(G, num_clusters)----
Spectral Modularitycugraph.spectralModularityMaximizationClustering(G, num_clusters)----
Triangle Countingcugraph.triangle_count(G)cugraph.dask.triangle_count()nx.triangles()
K-Trusscugraph.k_truss(G, k) or cugraph.ktruss_subgraph(G, k)cugraph.dask.ktruss_subgraph()nx.k_truss()
EgoNetcugraph.ego_graph(G, n, radius=)cugraph.dask.ego_graph()nx.ego_graph()
Induced Subgraphcugraph.induced_subgraph(G, vertices)cugraph.dask.induced_subgraph()G.subgraph(vertices)

Clustering Analysis:

  • cugraph.analyzeClustering_edge_cut(G, n_clusters, clustering)
  • cugraph.analyzeClustering_modularity(G, n_clusters, clustering)
  • cugraph.analyzeClustering_ratio_cut(G, n_clusters, clustering)
Raw lines 339 to 357
358### Traversal
360| Algorithm | Single-GPU | Multi-GPU | NetworkX Equivalent |
361|---|---|---|---|
362| BFS | `cugraph.bfs(G, start=, depth_limit=)` | `cugraph.dask.bfs()` | `nx.bfs_edges()` |
363| BFS Edges | `cugraph.bfs_edges(G, source)` | -- | `nx.bfs_edges()` |
364| SSSP | `cugraph.sssp(G, source=)` | `cugraph.dask.sssp()` | `nx.single_source_dijkstra()` |
365| Shortest Path | `cugraph.shortest_path(G, source=)` | -- | `nx.shortest_path()` |
366| Shortest Path Length | `cugraph.shortest_path_length(G, source, target=)` | -- | `nx.shortest_path_length()` |
367| Filter Unreachable | `cugraph.filter_unreachable(df)` | -- | -- |

Traversal

AlgorithmSingle-GPUMulti-GPUNetworkX Equivalent
BFScugraph.bfs(G, start=, depth_limit=)cugraph.dask.bfs()nx.bfs_edges()
BFS Edgescugraph.bfs_edges(G, source)--nx.bfs_edges()
SSSPcugraph.sssp(G, source=)cugraph.dask.sssp()nx.single_source_dijkstra()
Shortest Pathcugraph.shortest_path(G, source=)--nx.shortest_path()
Shortest Path Lengthcugraph.shortest_path_length(G, source, target=)--nx.shortest_path_length()
Filter Unreachablecugraph.filter_unreachable(df)----
Raw lines 358 to 368
369### Link Analysis
371| Algorithm | Single-GPU | Multi-GPU | NetworkX Equivalent |
372|---|---|---|---|
373| PageRank | `cugraph.pagerank(G, alpha=)` | `cugraph.dask.pagerank()` | `nx.pagerank()` |
374| HITS | `cugraph.hits(G, max_iter=, tol=)` | `cugraph.dask.hits()` | `nx.hits()` |

Link Analysis

AlgorithmSingle-GPUMulti-GPUNetworkX Equivalent
PageRankcugraph.pagerank(G, alpha=)cugraph.dask.pagerank()nx.pagerank()
HITScugraph.hits(G, max_iter=, tol=)cugraph.dask.hits()nx.hits()
Raw lines 369 to 375
376### Link Prediction / Similarity
378| Algorithm | Single-GPU | Multi-GPU | NetworkX Equivalent |
379|---|---|---|---|
380| Jaccard | `cugraph.jaccard(G, vertex_pair=)` | `cugraph.dask.jaccard()` | `nx.jaccard_coefficient()` |
381| Cosine Similarity | `cugraph.cosine(G, vertex_pair=)` | `cugraph.dask.cosine()` | -- |
382| Overlap | `cugraph.overlap(G, vertex_pair=)` | `cugraph.dask.overlap()` | -- |
383| Sorensen | `cugraph.sorensen(G, vertex_pair=)` | `cugraph.dask.sorensen()` | -- |
385**NetworkX-compatible wrappers:** `cugraph.jaccard_coefficient(G, ebunch)`, `cugraph.overlap_coefficient(G, ebunch)`, `cugraph.sorensen_coefficient(G, ebunch)`

Link Prediction / Similarity

AlgorithmSingle-GPUMulti-GPUNetworkX Equivalent
Jaccardcugraph.jaccard(G, vertex_pair=)cugraph.dask.jaccard()nx.jaccard_coefficient()
Cosine Similaritycugraph.cosine(G, vertex_pair=)cugraph.dask.cosine()--
Overlapcugraph.overlap(G, vertex_pair=)cugraph.dask.overlap()--
Sorensencugraph.sorensen(G, vertex_pair=)cugraph.dask.sorensen()--

NetworkX-compatible wrappers: cugraph.jaccard_coefficient(G, ebunch), cugraph.overlap_coefficient(G, ebunch), cugraph.sorensen_coefficient(G, ebunch)

Raw lines 376 to 386
387### Components
389| Algorithm | Single-GPU | Multi-GPU | NetworkX Equivalent |
390|---|---|---|---|
391| Connected Components | `cugraph.connected_components(G)` | -- | `nx.connected_components()` |
392| Weakly Connected | `cugraph.weakly_connected_components(G)` | `cugraph.dask.weakly_connected_components()` | `nx.weakly_connected_components()` |
393| Strongly Connected | `cugraph.strongly_connected_components(G)` | -- | `nx.strongly_connected_components()` |

Components

AlgorithmSingle-GPUMulti-GPUNetworkX Equivalent
Connected Componentscugraph.connected_components(G)--nx.connected_components()
Weakly Connectedcugraph.weakly_connected_components(G)cugraph.dask.weakly_connected_components()nx.weakly_connected_components()
Strongly Connectedcugraph.strongly_connected_components(G)--nx.strongly_connected_components()
Raw lines 387 to 394
395### Cores
397| Algorithm | Single-GPU | Multi-GPU | NetworkX Equivalent |
398|---|---|---|---|
399| Core Number | `cugraph.core_number(G, degree_type=)` | `cugraph.dask.core_number()` | `nx.core_number()` |
400| K-Core | `cugraph.k_core(G, k=, core_number=)` | `cugraph.dask.k_core()` | `nx.k_core()` |

Cores

AlgorithmSingle-GPUMulti-GPUNetworkX Equivalent
Core Numbercugraph.core_number(G, degree_type=)cugraph.dask.core_number()nx.core_number()
K-Corecugraph.k_core(G, k=, core_number=)cugraph.dask.k_core()nx.k_core()
Raw lines 395 to 401
402### Sampling
404| Algorithm | Single-GPU | Multi-GPU | Notes |
405|---|---|---|---|
406| Biased Random Walks | `cugraph.biased_random_walks(G, start_vertices)` | `cugraph.dask.biased_random_walks()` | Weighted/biased traversal |
407| Uniform Random Walks | -- | `cugraph.dask.uniform_random_walks()` | Padded result with max path length |
408| Random Walks | -- | `cugraph.dask.random_walks()` | General random walk |
409| Node2Vec | -- | `cugraph.dask.sampling.node2vec_random_walks()` | Node2Vec sampling framework |
410| Homogeneous Neighbor Sample | `cugraph.homogeneous_neighbor_sample(G, start_vertices, fanout)` | -- | Configurable fan-out per hop |
411| Heterogeneous Neighbor Sample | `cugraph.heterogeneous_neighbor_sample(G, ...)` | -- | Multi-type node/edge graphs |

Sampling

AlgorithmSingle-GPUMulti-GPUNotes
Biased Random Walkscugraph.biased_random_walks(G, start_vertices)cugraph.dask.biased_random_walks()Weighted/biased traversal
Uniform Random Walks--cugraph.dask.uniform_random_walks()Padded result with max path length
Random Walks--cugraph.dask.random_walks()General random walk
Node2Vec--cugraph.dask.sampling.node2vec_random_walks()Node2Vec sampling framework
Homogeneous Neighbor Samplecugraph.homogeneous_neighbor_sample(G, start_vertices, fanout)--Configurable fan-out per hop
Heterogeneous Neighbor Samplecugraph.heterogeneous_neighbor_sample(G, ...)--Multi-type node/edge graphs
Raw lines 402 to 412
413### Layout
415| Algorithm | Single-GPU | Multi-GPU | NetworkX Equivalent |
416|---|---|---|---|
417| Force Atlas 2 | `cugraph.force_atlas2(G)` | -- | `nx.forceatlas2_layout()` (via nx-cugraph) |

Layout

AlgorithmSingle-GPUMulti-GPUNetworkX Equivalent
Force Atlas 2cugraph.force_atlas2(G)--nx.forceatlas2_layout() (via nx-cugraph)
Raw lines 413 to 418
419### Tree
421| Algorithm | Single-GPU | Multi-GPU | NetworkX Equivalent |
422|---|---|---|---|
423| Minimum Spanning Tree | `cugraph.minimum_spanning_tree(G)` | -- | `nx.minimum_spanning_tree()` |
424| Maximum Spanning Tree | `cugraph.maximum_spanning_tree(G)` | -- | `nx.maximum_spanning_tree()` |

Tree

AlgorithmSingle-GPUMulti-GPUNetworkX Equivalent
Minimum Spanning Treecugraph.minimum_spanning_tree(G)--nx.minimum_spanning_tree()
Maximum Spanning Treecugraph.maximum_spanning_tree(G)--nx.maximum_spanning_tree()
Raw lines 419 to 425
426### Linear Assignment
428| Algorithm | Single-GPU | Multi-GPU |
429|---|---|---|
430| Hungarian | `cugraph.hungarian(G, workers, cost)` | -- |

Linear Assignment

AlgorithmSingle-GPUMulti-GPU
Hungariancugraph.hungarian(G, workers, cost)--
Raw lines 426 to 431
432### Utilities
434| Function | Purpose |
435|---|---|
436| `cugraph.symmetrize(src, dst, val)` | Make edges bidirectional (for undirected graphs) |
437| `cugraph.symmetrize_df(df, src, dst)` | Symmetrize a DataFrame |
438| `cugraph.symmetrize_ddf(ddf, src, dst)` | Symmetrize a Dask DataFrame |
439| `cugraph.NumberMap` | Map external vertex IDs to contiguous internal IDs |
440| `G.unrenumber(df, col)` | Map internal vertex IDs back to original |
442---

Utilities

FunctionPurpose
cugraph.symmetrize(src, dst, val)Make edges bidirectional (for undirected graphs)
cugraph.symmetrize_df(df, src, dst)Symmetrize a DataFrame
cugraph.symmetrize_ddf(ddf, src, dst)Symmetrize a Dask DataFrame
cugraph.NumberMapMap external vertex IDs to contiguous internal IDs
G.unrenumber(df, col)Map internal vertex IDs back to original

Raw lines 432 to 443
444## Multi-GPU Support with Dask
446cuGraph supports multi-GPU computation through Dask for graphs that exceed single-GPU memory or need faster processing.

Multi-GPU Support with Dask

cuGraph supports multi-GPU computation through Dask for graphs that exceed single-GPU memory or need faster processing.

Raw lines 444 to 447
448### Setup
449```python
450from dask.distributed import Client
451from dask_cuda import LocalCUDACluster
452import cugraph
453import cugraph.dask as dask_cugraph
454import dask_cudf
456# Initialize multi-GPU cluster
457cluster = LocalCUDACluster()
458client = Client(cluster)
459import cugraph.dask.comms.comms as Comms
460Comms.initialize(p2p=True)
462# Load distributed edge list
463ddf = dask_cudf.read_csv("large_graph.csv", names=["src", "dst", "weight"])
465# Create distributed graph
466G = cugraph.Graph(directed=True)
467G.from_dask_cudf_edgelist(ddf, source="src", destination="dst", edge_attr="weight")
469# Run multi-GPU algorithms
470pr = dask_cugraph.pagerank(G)
471components = dask_cugraph.weakly_connected_components(G)
472# Materialize or write distributed outputs before teardown.
473pr_local = pr.compute()
474Comms.destroy()
475client.close()
476cluster.close()
477```

Setup

from dask.distributed import Client
from dask_cuda import LocalCUDACluster
import cugraph
import cugraph.dask as dask_cugraph
import dask_cudf

# Initialize multi-GPU cluster
cluster = LocalCUDACluster()
client = Client(cluster)
import cugraph.dask.comms.comms as Comms
Comms.initialize(p2p=True)

# Load distributed edge list
ddf = dask_cudf.read_csv("large_graph.csv", names=["src", "dst", "weight"])

# Create distributed graph
G = cugraph.Graph(directed=True)
G.from_dask_cudf_edgelist(ddf, source="src", destination="dst", edge_attr="weight")

# Run multi-GPU algorithms
pr = dask_cugraph.pagerank(G)
components = dask_cugraph.weakly_connected_components(G)
# Materialize or write distributed outputs before teardown.
pr_local = pr.compute()
Comms.destroy()
client.close()
cluster.close()
Raw lines 448 to 478
479### Algorithms with Multi-GPU Support
481The following algorithms have Dask-based multi-GPU implementations:
482- **Centrality:** Betweenness, Edge Betweenness, Eigenvector, Katz
483- **Community:** Louvain, Leiden, ECG, K-Truss, Triangle Counting, EgoNet, Induced Subgraph
484- **Components:** Weakly Connected Components
485- **Cores:** Core Number, K-Core
486- **Link Analysis:** PageRank, HITS
487- **Link Prediction:** Overlap, Sorensen
488- **Sampling:** Random Walks, Biased Random Walks, Uniform Random Walks, Node2Vec, Neighborhood Sampling
489- **Traversal:** BFS, SSSP
490- **Utilities:** Renumbering, Symmetrize, Path Extraction, Two-Hop Neighbors, RMAT Generator
492---

Algorithms with Multi-GPU Support

The following algorithms have Dask-based multi-GPU implementations:

  • Centrality: Betweenness, Edge Betweenness, Eigenvector, Katz
  • Community: Louvain, Leiden, ECG, K-Truss, Triangle Counting, EgoNet, Induced Subgraph
  • Components: Weakly Connected Components
  • Cores: Core Number, K-Core
  • Link Analysis: PageRank, HITS
  • Link Prediction: Overlap, Sorensen
  • Sampling: Random Walks, Biased Random Walks, Uniform Random Walks, Node2Vec, Neighborhood Sampling
  • Traversal: BFS, SSSP
  • Utilities: Renumbering, Symmetrize, Path Extraction, Two-Hop Neighbors, RMAT Generator

Raw lines 479 to 493
494## GNN Support
496### cugraph-pyg (PyTorch Geometric Integration)
498As of release 25.06, **cugraph-pyg is the recommended GNN framework integration** (cuGraph-DGL has been removed).
500cugraph-pyg provides native GPU-accelerated implementations of PyG's core interfaces:
502- **GraphStore**: GPU-accelerated graph storage using cuGraph's CSR representation
503- **FeatureStore**: GPU-resident feature storage for node/edge features
504- **Sampler/Loader**: GPU-accelerated neighborhood sampling with configurable fan-out
506```bash
507uv add --extra-index-url=https://pypi.nvidia.com "cugraph-pyg-cu12==26.8.*"
508```
510**Key capabilities:**
511- Heterogeneous graph sampling (multiple node/edge types)
512- Multi-GPU distributed sampling
513- Direct integration with PyG's `NeighborLoader` and training loops
514- GPU-accelerated centrality, community detection, and other analytics within PyG workflows
516**Repository:** https://github.com/rapidsai/cugraph-gnn

cugraph-pyg (PyTorch Geometric Integration)

As of release 25.06, cugraph-pyg is the recommended GNN framework integration (cuGraph-DGL has been removed).

cugraph-pyg provides native GPU-accelerated implementations of PyG's core interfaces:

  • GraphStore: GPU-accelerated graph storage using cuGraph's CSR representation
  • FeatureStore: GPU-resident feature storage for node/edge features
  • Sampler/Loader: GPU-accelerated neighborhood sampling with configurable fan-out
uv add --extra-index-url=https://pypi.nvidia.com "cugraph-pyg-cu12==26.8.*"

Key capabilities:

  • Heterogeneous graph sampling (multiple node/edge types)
  • Multi-GPU distributed sampling
  • Direct integration with PyG's NeighborLoader and training loops
  • GPU-accelerated centrality, community detection, and other analytics within PyG workflows

Repository: https://github.com/rapidsai/cugraph-gnn

Raw lines 496 to 517
518### WholeGraph (Distributed GPU Memory for GNNs)
520WholeGraph provides distributed GPU memory management for large-scale GNN training through its **WholeMemory** abstraction.
522```bash
523uv add --extra-index-url=https://pypi.nvidia.com "pylibwholegraph-cu12==26.8.*"
524```
526**Core concepts:**
528- **WholeMemory**: A unified view of GPU memory distributed across multiple GPUs. Each GPU sees the entire memory space through a single abstraction, even though data is physically distributed.
529- **WholeMemory Communicator**: Defines the set of GPUs that collaborate, with one process per GPU.
530- **WholeMemory Tensor**: Like PyTorch tensors but distributed; supports 1D and 2D data with first dimension partitioned across GPUs.
531- **WholeMemory Embedding**: 2D tensor variant with built-in cache policies and sparse optimizers (SGD, Adam, RMSProp, AdaGrad).
533**Memory modes:**
534| Mode | Description | Use Case |
535|---|---|---|
536| **Continuous** | Single continuous address space via hardware peer-to-peer | NVLink systems (DGX) |
537| **Chunked** | Per-GPU chunks with direct multi-pointer access | Multi-GPU with some NVLink |
538| **Distributed** | Explicit communication required for remote access | Multi-node clusters |
540**Storage locations:** Host memory (pinned) or device/GPU memory.
542**Graph storage:** CSR format with ROW_INDEX and COL_INDEX as WholeMemory Tensors for efficient distributed graph management.
544**Cache policies:** Device-cached host memory, local-cached global memory -- critical for handling graphs larger than GPU memory.
546**Target hardware:** NVLink systems like DGX A100/H100 servers for optimal performance.

WholeGraph (Distributed GPU Memory for GNNs)

WholeGraph provides distributed GPU memory management for large-scale GNN training through its WholeMemory abstraction.

uv add --extra-index-url=https://pypi.nvidia.com "pylibwholegraph-cu12==26.8.*"

Core concepts:

  • WholeMemory: A unified view of GPU memory distributed across multiple GPUs. Each GPU sees the entire memory space through a single abstraction, even though data is physically distributed.
  • WholeMemory Communicator: Defines the set of GPUs that collaborate, with one process per GPU.
  • WholeMemory Tensor: Like PyTorch tensors but distributed; supports 1D and 2D data with first dimension partitioned across GPUs.
  • WholeMemory Embedding: 2D tensor variant with built-in cache policies and sparse optimizers (SGD, Adam, RMSProp, AdaGrad).

Memory modes:

ModeDescriptionUse Case
ContinuousSingle continuous address space via hardware peer-to-peerNVLink systems (DGX)
ChunkedPer-GPU chunks with direct multi-pointer accessMulti-GPU with some NVLink
DistributedExplicit communication required for remote accessMulti-node clusters

Storage locations: Host memory (pinned) or device/GPU memory.

Graph storage: CSR format with ROW_INDEX and COL_INDEX as WholeMemory Tensors for efficient distributed graph management.

Cache policies: Device-cached host memory, local-cached global memory -- critical for handling graphs larger than GPU memory.

Target hardware: NVLink systems like DGX A100/H100 servers for optimal performance.

Raw lines 518 to 547
548### cuGraph-DGL (DEPRECATED)
550**cuGraph-DGL has been removed as of release 25.06.** Users should migrate to cugraph-pyg. The cuGraph team is not planning further work in the DGL ecosystem.
552---

cuGraph-DGL (DEPRECATED)

cuGraph-DGL has been removed as of release 25.06. Users should migrate to cugraph-pyg. The cuGraph team is not planning further work in the DGL ecosystem.


Raw lines 548 to 553
554## Performance Characteristics and Benchmarks
556Benchmark with the user's actual topology and algorithm:
5581. Check that the requested NetworkX algorithm dispatches to nx-cugraph rather than falling back
559 to CPU.
5602. Measure graph construction and conversion separately from repeated algorithm calls, then report
561 both warm algorithm time and end-to-end time.
5623. Warm the CUDA context before collecting timed repetitions.
5634. Verify output semantics, convergence tolerance, sampled-algorithm parameters, and floating-point
564 tolerance against the CPU implementation.
5655. Record vertices, edges, directedness, weight dtype, GPU model, CPU baseline, software versions,
566 and whether the graph was already device-resident.
5676. Use multi-GPU only after estimating graph and temporary-memory requirements and measuring the
568 communication cost.
570Small or one-shot graphs can lose to NetworkX after setup and transfer. Large device-resident
571graphs with supported algorithms are better candidates, but graph size alone does not establish a
572speedup.
574---

Performance Characteristics and Benchmarks

Benchmark with the user's actual topology and algorithm:

  1. Check that the requested NetworkX algorithm dispatches to nx-cugraph rather than falling back to CPU.
  2. Measure graph construction and conversion separately from repeated algorithm calls, then report both warm algorithm time and end-to-end time.
  3. Warm the CUDA context before collecting timed repetitions.
  4. Verify output semantics, convergence tolerance, sampled-algorithm parameters, and floating-point tolerance against the CPU implementation.
  5. Record vertices, edges, directedness, weight dtype, GPU model, CPU baseline, software versions, and whether the graph was already device-resident.
  6. Use multi-GPU only after estimating graph and temporary-memory requirements and measuring the communication cost.

Small or one-shot graphs can lose to NetworkX after setup and transfer. Large device-resident graphs with supported algorithms are better candidates, but graph size alone does not establish a speedup.


Raw lines 554 to 575
Starts an agent dispatches :558
576## Memory Management

Memory Management

Raw lines 576 to 577
578### GPU Memory Considerations
580- cuGraph stores graphs in CSR format on GPU memory
581- Estimate CSR storage from offset/index/weight dtypes, edge symmetrization, renumber maps and retained edge lists. Peak construction/algorithm memory can be much larger than final CSR storage.
582- Algorithm working memory varies; some algorithms (like betweenness centrality) need additional O(V) or O(E) temporary space

GPU Memory Considerations

  • cuGraph stores graphs in CSR format on GPU memory
  • Estimate CSR storage from offset/index/weight dtypes, edge symmetrization, renumber maps and retained edge lists. Peak construction/algorithm memory can be much larger than final CSR storage.
  • Algorithm working memory varies; some algorithms (like betweenness centrality) need additional O(V) or O(E) temporary space
Raw lines 578 to 583
584### Strategies for Large Graphs
5861. **Use multi-GPU** via Dask for graphs exceeding single GPU memory
5872. **Use WholeGraph** for GNN workloads that need distributed feature/graph storage
5883. **Use `rmm`** (RAPIDS Memory Manager) for fine-grained GPU memory control:
589 ```python
590 import rmm
591 rmm.reinitialize(pool_allocator=True, initial_pool_size=2**30) # 1 GB pool
592 ```
5934. **Monitor memory** with `nvidia-smi` or `cupy.cuda.runtime.memGetInfo()` (device free/total, not per-process peak)
5945. **Delete intermediate results** explicitly: `del result; import gc; gc.collect()`
596---

Strategies for Large Graphs

  1. Use multi-GPU via Dask for graphs exceeding single GPU memory
  2. Use WholeGraph for GNN workloads that need distributed feature/graph storage
  3. **Use rmm** (RAPIDS Memory Manager) for fine-grained GPU memory control: ``python import rmm rmm.reinitialize(pool_allocator=True, initial_pool_size=2**30) # 1 GB pool
  4. Monitor memory with nvidia-smi or cupy.cuda.runtime.memGetInfo() (device free/total, not per-process peak)
  5. Delete intermediate results explicitly: del result; import gc; gc.collect()

Raw lines 584 to 597
598## Interoperability

Interoperability

Raw lines 598 to 599
600### With cuDF
601cuGraph natively consumes and produces cuDF DataFrames. Algorithm results are returned as cuDF DataFrames with vertex/edge columns.
603```python
604import cudf, cugraph
605# Create graph from cuDF
606edges = cudf.read_csv("edges.csv")
607G = cugraph.Graph()
608G.from_cudf_edgelist(edges, source="src", destination="dst")
610# Results come back as cuDF DataFrames
611pr = cugraph.pagerank(G) # cuDF DataFrame with 'vertex' and 'pagerank' columns
612```

With cuDF

cuGraph natively consumes and produces cuDF DataFrames. Algorithm results are returned as cuDF DataFrames with vertex/edge columns.

import cudf, cugraph
# Create graph from cuDF
edges = cudf.read_csv("edges.csv")
G = cugraph.Graph()
G.from_cudf_edgelist(edges, source="src", destination="dst")

# Results come back as cuDF DataFrames
pr = cugraph.pagerank(G)  # cuDF DataFrame with 'vertex' and 'pagerank' columns
Raw lines 600 to 613
614### With cuML
615Pipe graph analytics results into cuML for downstream ML:
616```python
617import cuml
618# Use graph embeddings (e.g., from Node2Vec) as features for cuML
619# Or use community labels as features for classification
620louvain_result = cugraph.louvain(G)
621# Feed partition labels into cuML models
622```

With cuML

Pipe graph analytics results into cuML for downstream ML:

import cuml
# Use graph embeddings (e.g., from Node2Vec) as features for cuML
# Or use community labels as features for classification
louvain_result = cugraph.louvain(G)
# Feed partition labels into cuML models
Raw lines 614 to 623
624### With CuPy / SciPy
625```python
626# cuGraph can work with CuPy and SciPy sparse matrices as input data
627import cupy, scipy
628```

With CuPy / SciPy

# cuGraph can work with CuPy and SciPy sparse matrices as input data
import cupy, scipy
Raw lines 624 to 629
630### With NetworkX
631```python
632import networkx as nx
633import nx_cugraph as nxcg
635# Convert once when repeated algorithms justify keeping the graph on GPU.
636G_nx = nx.karate_club_graph()
637G_gpu = nxcg.from_networkx(G_nx)
638result = nx.pagerank(G_gpu)
639```

With NetworkX

import networkx as nx
import nx_cugraph as nxcg

# Convert once when repeated algorithms justify keeping the graph on GPU.
G_nx = nx.karate_club_graph()
G_gpu = nxcg.from_networkx(G_nx)
result = nx.pagerank(G_gpu)
Raw lines 630 to 640
641### With PyTorch Geometric
642```python
643# Via cugraph-pyg (see GNN Support section)
644from cugraph_pyg.data import GraphStore, FeatureStore
645from cugraph_pyg.loader import NeighborLoader
646```

With PyTorch Geometric

# Via cugraph-pyg (see GNN Support section)
from cugraph_pyg.data import GraphStore, FeatureStore
from cugraph_pyg.loader import NeighborLoader
Raw lines 641 to 647
648### With Pandas
649```python
650import pandas as pd
651df = pd.DataFrame({"src": [0, 1, 2], "dst": [1, 2, 3]})
652G = cugraph.Graph()
653G.from_pandas_edgelist(df, source="src", destination="dst")
654```
656---

With Pandas

import pandas as pd
df = pd.DataFrame({"src": [0, 1, 2], "dst": [1, 2, 3]})
G = cugraph.Graph()
G.from_pandas_edgelist(df, source="src", destination="dst")

Raw lines 648 to 657
658## Known Limitations vs NetworkX
6601. **Immutable graphs:** Cannot add/remove individual edges after graph creation. Must reconstruct from DataFrame.
6612. **No node/edge attributes on Graph object:** cuGraph stores structure only. Node/edge properties must be maintained separately (e.g., in cuDF DataFrames). The nx-cugraph backend handles attribute mapping transparently.
6623. **Vertex types:** Vertices must be integers (or will be renumbered to integers internally). String vertex IDs are renumbered automatically.
6634. **Not all NetworkX algorithms supported:** Check the nx-cugraph supported algorithms list. Unsupported calls fall back to CPU NetworkX.
6645. **Numerical precision:** GPU floating-point results may differ slightly from CPU results due to parallel reduction ordering.
6656. **No dynamic graphs:** cuGraph is designed for static graph analytics, not streaming/dynamic graph updates.
6667. **Strongly Connected Components:** Single-GPU only (no multi-GPU Dask variant).
6678. **Spectral Clustering:** Single-GPU only.
6689. **Minimum/Maximum Spanning Tree:** Single-GPU only.
66910. **Force Atlas 2 layout:** Single-GPU only.
67011. **Compatibility doc:** The official list of NetworkX APIs accelerated by nx-cugraph is maintained at https://docs.nvidia.com/cugraph/26.08/nx_cugraph/supported-algorithms/ (~80 algorithms plus generators and utilities).
672---

Known Limitations vs NetworkX

  1. Immutable graphs: Cannot add/remove individual edges after graph creation. Must reconstruct from DataFrame.
  2. No node/edge attributes on Graph object: cuGraph stores structure only. Node/edge properties must be maintained separately (e.g., in cuDF DataFrames). The nx-cugraph backend handles attribute mapping transparently.
  3. Vertex types: Vertices must be integers (or will be renumbered to integers internally). String vertex IDs are renumbered automatically.
  4. Not all NetworkX algorithms supported: Check the nx-cugraph supported algorithms list. Unsupported calls fall back to CPU NetworkX.
  5. Numerical precision: GPU floating-point results may differ slightly from CPU results due to parallel reduction ordering.
  6. No dynamic graphs: cuGraph is designed for static graph analytics, not streaming/dynamic graph updates.
  7. Strongly Connected Components: Single-GPU only (no multi-GPU Dask variant).
  8. Spectral Clustering: Single-GPU only.
  9. Minimum/Maximum Spanning Tree: Single-GPU only.
  10. Force Atlas 2 layout: Single-GPU only.
  11. Compatibility doc: The official list of NetworkX APIs accelerated by nx-cugraph is maintained at https://docs.nvidia.com/cugraph/26.08/nx_cugraph/supported-algorithms/ (~80 algorithms plus generators and utilities).

Raw lines 658 to 673
674## Common Migration Patterns

Common Migration Patterns

Raw lines 674 to 675
676### NetworkX to nx-cugraph (Zero Effort)
677```python
678# Before (CPU):
679import networkx as nx
680G = nx.from_pandas_edgelist(df, "src", "dst")
681pr = nx.pagerank(G)
683# After (GPU, no code changes):
684# Just set: NX_CUGRAPH_AUTOCONFIG=True
685# Same code runs on GPU automatically
686```

NetworkX to nx-cugraph (Zero Effort)

# Before (CPU):
import networkx as nx
G = nx.from_pandas_edgelist(df, "src", "dst")
pr = nx.pagerank(G)

# After (GPU, no code changes):
# Just set: NX_CUGRAPH_AUTOCONFIG=True
# Same code runs on GPU automatically
Raw lines 676 to 687
688### NetworkX to Direct cuGraph API
689```python
690# Before (NetworkX):
691import networkx as nx
692G = nx.from_pandas_edgelist(df, "src", "dst")
693pr = nx.pagerank(G, alpha=0.85)
694bc = nx.betweenness_centrality(G) # Exact baseline; use matched sampling for large graphs
695communities = nx.community.louvain_communities(G, resolution=1.0)
697# After (cuGraph):
698import cudf, cugraph
699edges = cudf.from_pandas(df)
700G = cugraph.Graph()
701G.from_cudf_edgelist(edges, source="src", destination="dst")
702pr = cugraph.pagerank(G, alpha=0.85)
703bc = cugraph.betweenness_centrality(G)
704parts, modularity = cugraph.louvain(G, resolution=1.0)
705```

NetworkX to Direct cuGraph API

# Before (NetworkX):
import networkx as nx
G = nx.from_pandas_edgelist(df, "src", "dst")
pr = nx.pagerank(G, alpha=0.85)
bc = nx.betweenness_centrality(G)  # Exact baseline; use matched sampling for large graphs
communities = nx.community.louvain_communities(G, resolution=1.0)

# After (cuGraph):
import cudf, cugraph
edges = cudf.from_pandas(df)
G = cugraph.Graph()
G.from_cudf_edgelist(edges, source="src", destination="dst")
pr = cugraph.pagerank(G, alpha=0.85)
bc = cugraph.betweenness_centrality(G)
parts, modularity = cugraph.louvain(G, resolution=1.0)
Raw lines 688 to 706
707### Pandas to cuDF + cuGraph Pipeline
708```python
709# Before:
710import pandas as pd
711import networkx as nx
712df = pd.read_csv("edges.csv")
713G = nx.from_pandas_edgelist(df, "source", "target", "weight")
714result = nx.pagerank(G)
716# After:
717import cudf
718import cugraph
719df = cudf.read_csv("edges.csv")
720G = cugraph.Graph()
721G.from_cudf_edgelist(df, source="source", destination="target", edge_attr="weight")
722result = cugraph.pagerank(G)
723```

Pandas to cuDF + cuGraph Pipeline

# Before:
import pandas as pd
import networkx as nx
df = pd.read_csv("edges.csv")
G = nx.from_pandas_edgelist(df, "source", "target", "weight")
result = nx.pagerank(G)

# After:
import cudf
import cugraph
df = cudf.read_csv("edges.csv")
G = cugraph.Graph()
G.from_cudf_edgelist(df, source="source", destination="target", edge_attr="weight")
result = cugraph.pagerank(G)
Raw lines 707 to 724
725### Adding Multi-GPU to Existing cuGraph Code
726```python
727# Before (single-GPU):
728import cugraph
729G = cugraph.Graph()
730G.from_cudf_edgelist(edges, source="src", destination="dst")
731result = cugraph.pagerank(G)
733# After (multi-GPU):
734from dask.distributed import Client
735from dask_cuda import LocalCUDACluster
736import cugraph, cugraph.dask as dcg
737import dask_cudf
739cluster = LocalCUDACluster()
740client = Client(cluster)
741import cugraph.dask.comms.comms as Comms
742Comms.initialize(p2p=True)
744ddf = dask_cudf.from_cudf(edges, npartitions=len(cluster.workers))
745G = cugraph.Graph()
746G.from_dask_cudf_edgelist(ddf, source="src", destination="dst")
747result = dcg.pagerank(G)
748result_local = result.compute() # Only if the result fits one GPU
749Comms.destroy()
750client.close()
751cluster.close()
752```

Adding Multi-GPU to Existing cuGraph Code

# Before (single-GPU):
import cugraph
G = cugraph.Graph()
G.from_cudf_edgelist(edges, source="src", destination="dst")
result = cugraph.pagerank(G)

# After (multi-GPU):
from dask.distributed import Client
from dask_cuda import LocalCUDACluster
import cugraph, cugraph.dask as dcg
import dask_cudf

cluster = LocalCUDACluster()
client = Client(cluster)
import cugraph.dask.comms.comms as Comms
Comms.initialize(p2p=True)

ddf = dask_cudf.from_cudf(edges, npartitions=len(cluster.workers))
G = cugraph.Graph()
G.from_dask_cudf_edgelist(ddf, source="src", destination="dst")
result = dcg.pagerank(G)
result_local = result.compute()  # Only if the result fits one GPU
Comms.destroy()
client.close()
cluster.close()
Raw lines 725 to 752