Skip to main content
Ctrl+K
NVIDIA cuGraph - Home NVIDIA cuGraph - Home

NVIDIA cuGraph

  • Basics
  • nx-cugraph
  • Installation
  • Tutorials
  • Graph Support
    • WholeGraph
    • References
    • Developer Resources
    • API Reference
  • GitHub
NVIDIA cuGraph - Home NVIDIA cuGraph - Home

NVIDIA cuGraph

  • Basics
  • nx-cugraph
  • Installation
  • Tutorials
  • Graph Support
  • WholeGraph
  • References
  • Developer Resources
  • API Reference
  • GitHub

Section Navigation

Traditional Graph Analytics in Python

  • cuGraph Python API
    • Graph Classes
      • cugraph.Graph
      • cugraph.MultiGraph
      • cugraph.BiPartiteGraph
      • cugraph.Graph.from_cudf_adjlist
      • cugraph.Graph.from_cudf_edgelist
      • cugraph.Graph.from_dask_cudf_edgelist
      • cugraph.Graph.from_pandas_adjacency
      • cugraph.Graph.from_pandas_edgelist
      • cugraph.Graph.from_numpy_array
      • cugraph.Graph.from_numpy_matrix
      • cugraph.Graph.add_internal_vertex_id
      • cugraph.Graph.add_nodes_from
      • cugraph.Graph.clear
      • cugraph.Graph.unrenumber
      • cugraph.Graph.has_isolated_vertices
      • cugraph.Graph.is_bipartite
      • cugraph.Graph.is_directed
      • cugraph.Graph.is_multigraph
      • cugraph.Graph.is_multipartite
      • cugraph.Graph.is_renumbered
      • cugraph.Graph.is_weighted
      • cugraph.Graph.lookup_internal_vertex_id
      • cugraph.Graph.to_directed
      • cugraph.Graph.to_undirected
      • cugraph.is_weighted
      • cugraph.is_directed
      • cugraph.is_multigraph
      • cugraph.is_bipartite
      • cugraph.is_multipartite
      • cugraph.symmetrize
      • cugraph.symmetrize_ddf
      • cugraph.symmetrize_df
      • cugraph.from_adjlist
      • cugraph.from_cudf_edgelist
      • cugraph.from_edgelist
      • cugraph.from_numpy_array
      • cugraph.from_numpy_matrix
      • cugraph.from_pandas_adjacency
      • cugraph.from_pandas_edgelist
      • cugraph.to_numpy_array
      • cugraph.to_numpy_matrix
      • cugraph.to_pandas_adjacency
      • cugraph.to_pandas_edgelist
      • cugraph.structure.NumberMap
      • cugraph.structure.NumberMap.from_internal_vertex_id
      • cugraph.structure.NumberMap.to_internal_vertex_id
      • cugraph.structure.NumberMap.add_internal_vertex_id
      • cugraph.structure.NumberMap.compute_vals
      • cugraph.structure.NumberMap.compute_vals_types
      • cugraph.structure.NumberMap.generate_unused_column_name
      • cugraph.structure.NumberMap.renumber
      • cugraph.structure.NumberMap.renumber_and_segment
      • cugraph.structure.NumberMap.set_renumbered_col_names
      • cugraph.structure.NumberMap.unrenumber
      • cugraph.structure.NumberMap.vertex_column_size
      • cugraph.hypergraph
    • Graph Implementation
      • cugraph.structure.graph_implementation.simpleGraphImpl.view_edge_list
      • cugraph.structure.graph_implementation.simpleGraphImpl.delete_edge_list
      • cugraph.structure.graph_implementation.simpleGraphImpl.view_adj_list
      • cugraph.structure.graph_implementation.simpleGraphImpl.view_transposed_adj_list
      • cugraph.structure.graph_implementation.simpleGraphImpl.delete_adj_list
      • cugraph.structure.graph_implementation.simpleGraphImpl.enable_batch
      • cugraph.structure.graph_implementation.simpleGraphImpl.get_two_hop_neighbors
      • cugraph.structure.graph_implementation.simpleGraphImpl.number_of_vertices
      • cugraph.structure.graph_implementation.simpleGraphImpl.number_of_nodes
      • cugraph.structure.graph_implementation.simpleGraphImpl.number_of_edges
      • cugraph.structure.graph_implementation.simpleGraphImpl.in_degree
      • cugraph.structure.graph_implementation.simpleGraphImpl.out_degree
      • cugraph.structure.graph_implementation.simpleGraphImpl.degree
      • cugraph.structure.graph_implementation.simpleGraphImpl.degrees
      • cugraph.structure.graph_implementation.simpleGraphImpl.has_edge
      • cugraph.structure.graph_implementation.simpleGraphImpl.has_node
      • cugraph.structure.graph_implementation.simpleGraphImpl.has_self_loop
      • cugraph.structure.graph_implementation.simpleGraphImpl.edges
      • cugraph.structure.graph_implementation.simpleGraphImpl.nodes
      • cugraph.structure.graph_implementation.simpleGraphImpl.neighbors
      • cugraph.structure.graph_implementation.simpleGraphImpl.vertex_column_size
    • Centrality
      • cugraph.centrality.betweenness_centrality
      • cugraph.centrality.edge_betweenness_centrality
      • cugraph.dask.centrality.betweenness_centrality.betweenness_centrality
      • cugraph.dask.centrality.betweenness_centrality.edge_betweenness_centrality
      • cugraph.centrality.katz_centrality
      • cugraph.dask.centrality.katz_centrality.katz_centrality
      • cugraph.centrality.degree_centrality
      • cugraph.centrality.eigenvector_centrality
      • cugraph.dask.centrality.eigenvector_centrality.eigenvector_centrality
    • Community
      • cugraph.ego_graph
      • cugraph.dask.community.egonet
      • cugraph.ecg
      • cugraph.dask.community.ecg.ecg
      • cugraph.k_truss
      • cugraph.ktruss_subgraph
      • cugraph.dask.community.ktruss_subgraph.ktruss_subgraph
      • cugraph.leiden
      • cugraph.dask.community.leiden.leiden
      • cugraph.louvain
      • cugraph.dask.community.louvain.louvain
      • cugraph.analyzeClustering_edge_cut
      • cugraph.analyzeClustering_modularity
      • cugraph.analyzeClustering_ratio_cut
      • cugraph.spectralBalancedCutClustering
      • cugraph.spectralModularityMaximizationClustering
      • cugraph.induced_subgraph
      • cugraph.dask.community.induced_subgraph.induced_subgraph
      • cugraph.triangle_count
      • cugraph.dask.community.triangle_count.triangle_count
    • Components
      • cugraph.connected_components
      • cugraph.strongly_connected_components
      • cugraph.weakly_connected_components
      • cugraph.dask.components.connectivity.weakly_connected_components
    • Cores
      • cugraph.core_number
      • cugraph.dask.cores.core_number.core_number
      • cugraph.k_core
      • cugraph.dask.cores.k_core.k_core
    • Layout
      • cugraph.force_atlas2
    • Linear Assignment
      • cugraph.hungarian
      • cugraph.dense_hungarian
    • Link Analysis
      • cugraph.hits
      • cugraph.dask.link_analysis.hits.hits
      • cugraph.pagerank
      • cugraph.dask.link_analysis.pagerank.pagerank
    • Link Prediction
      • cugraph.cosine
      • cugraph.cosine_coefficient
      • cugraph.all_pairs_cosine
      • cugraph.dask.link_prediction.cosine.cosine
      • cugraph.dask.all_pairs_cosine
      • cugraph.jaccard
      • cugraph.jaccard_coefficient
      • cugraph.all_pairs_jaccard
      • cugraph.dask.link_prediction.jaccard.jaccard
      • cugraph.dask.all_pairs_jaccard
      • cugraph.overlap
      • cugraph.overlap_coefficient
      • cugraph.all_pairs_overlap
      • cugraph.dask.link_prediction.overlap.overlap
      • cugraph.dask.all_pairs_overlap
      • cugraph.sorensen
      • cugraph.sorensen_coefficient
      • cugraph.all_pairs_sorensen
      • cugraph.dask.link_prediction.sorensen.sorensen
      • cugraph.dask.all_pairs_sorensen
    • Sampling
      • cugraph.uniform_random_walks
      • cugraph.biased_random_walks
      • cugraph.node2vec_random_walks
      • cugraph.dask.random_walks
      • cugraph.dask.uniform_random_walks
      • cugraph.dask.biased_random_walks
      • cugraph.dask.node2vec_random_walks
      • cugraph.homogeneous_neighbor_sample
      • cugraph.heterogeneous_neighbor_sample
    • Traversal
      • cugraph.bfs
      • cugraph.bfs_edges
      • cugraph.concurrent_bfs
      • cugraph.multi_source_bfs
      • cugraph.dask.traversal.bfs.bfs
      • cugraph.filter_unreachable
      • cugraph.shortest_path
      • cugraph.shortest_path_length
      • cugraph.sssp
      • cugraph.dask.traversal.sssp.sssp
    • Tree
      • cugraph.tree.minimum_spanning_tree.minimum_spanning_tree
      • cugraph.tree.minimum_spanning_tree.maximum_spanning_tree
    • Generators
      • cugraph.generators.rmat
    • DASK MG Helper functions
      • cugraph.dask.comms.comms.initialize
      • cugraph.dask.comms.comms.destroy
      • cugraph.dask.comms.comms.is_initialized
      • cugraph.dask.comms.comms.get_comms
      • cugraph.dask.comms.comms.get_workers
      • cugraph.dask.comms.comms.get_session_id
      • cugraph.dask.comms.comms.get_2D_partition
      • cugraph.dask.comms.comms.get_default_handle
      • cugraph.dask.comms.comms.get_handle
      • cugraph.dask.comms.comms.get_worker_id
      • cugraph.dask.common.read_utils.get_chunksize
      • cugraph.dask.common.read_utils.get_n_workers
    • Multi-GPU with cuGraph
  • pylibcugraph API
    • Graphs and resources
      • pylibcugraph.SGGraph
      • pylibcugraph.MGGraph
      • pylibcugraph.ResourceHandle
      • pylibcugraph.GraphProperties
      • pylibcugraph.EdgeIdLookupTable
      • pylibcugraph.CuGraphRandomState
    • Centrality and link analysis
      • pylibcugraph.pagerank
      • pylibcugraph.personalized_pagerank
      • pylibcugraph.hits
      • pylibcugraph.eigenvector_centrality
      • pylibcugraph.katz_centrality
      • pylibcugraph.betweenness_centrality
      • pylibcugraph.edge_betweenness_centrality
    • Traversal, components, and cores
      • pylibcugraph.bfs
      • pylibcugraph.sssp
      • pylibcugraph.weakly_connected_components
      • pylibcugraph.strongly_connected_components
      • pylibcugraph.core_number
      • pylibcugraph.k_core
      • pylibcugraph.minimum_spanning_tree
    • Community and subgraphs
      • pylibcugraph.louvain
      • pylibcugraph.leiden
      • pylibcugraph.ecg
      • pylibcugraph.triangle_count
      • pylibcugraph.ego_graph
      • pylibcugraph.induced_subgraph
      • pylibcugraph.k_truss_subgraph
      • pylibcugraph.balanced_cut_clustering
      • pylibcugraph.spectral_modularity_maximization
      • pylibcugraph.analyze_clustering_modularity
      • pylibcugraph.analyze_clustering_edge_cut
      • pylibcugraph.analyze_clustering_ratio_cut
    • Sampling
      • pylibcugraph.uniform_random_walks
      • pylibcugraph.biased_random_walks
      • pylibcugraph.node2vec_random_walks
      • pylibcugraph.homogeneous_uniform_neighbor_sample
      • pylibcugraph.homogeneous_uniform_temporal_neighbor_sample
      • pylibcugraph.homogeneous_biased_neighbor_sample
      • pylibcugraph.homogeneous_biased_temporal_neighbor_sample
      • pylibcugraph.heterogeneous_uniform_neighbor_sample
      • pylibcugraph.heterogeneous_uniform_temporal_neighbor_sample
      • pylibcugraph.heterogeneous_biased_neighbor_sample
      • pylibcugraph.heterogeneous_biased_temporal_neighbor_sample
      • pylibcugraph.negative_sampling
      • pylibcugraph.select_random_vertices
    • Similarity
      • pylibcugraph.jaccard_coefficients
      • pylibcugraph.overlap_coefficients
      • pylibcugraph.sorensen_coefficients
      • pylibcugraph.cosine_coefficients
      • pylibcugraph.all_pairs_jaccard_coefficients
      • pylibcugraph.all_pairs_overlap_coefficients
      • pylibcugraph.all_pairs_sorensen_coefficients
      • pylibcugraph.all_pairs_cosine_coefficients
    • Graph construction and utilities
      • pylibcugraph.generate_rmat_edgelist
      • pylibcugraph.generate_rmat_edgelists
      • pylibcugraph.replicate_edgelist
      • pylibcugraph.renumber_arbitrary_edgelist
      • pylibcugraph.decompress_to_edgelist
      • pylibcugraph.degrees
      • pylibcugraph.in_degrees
      • pylibcugraph.out_degrees
      • pylibcugraph.get_two_hop_neighbors
      • pylibcugraph.has_vertex
      • pylibcugraph.extract_vertex_list
      • pylibcugraph.force_atlas2
  • nx-cugraph API

GNN Libraries

  • cuGraph-PyG API
    • Graph storage
      • cugraph_pyg.data.GraphStore
    • Feature storage
      • cugraph_pyg.data.FeatureStore
    • Tensors and embeddings
      • cugraph_pyg.tensor.DistTensor
      • cugraph_pyg.tensor.DistEmbedding
      • cugraph_pyg.tensor.DistMatrix
      • cugraph_pyg.tensor.is_empty
      • cugraph_pyg.tensor.empty
    • Data loaders
      • cugraph_pyg.loader.NodeLoader
      • cugraph_pyg.loader.NeighborLoader
      • cugraph_pyg.loader.LinkLoader
      • cugraph_pyg.loader.LinkNeighborLoader
    • Samplers
      • cugraph_pyg.sampler.BaseSampler
      • cugraph_pyg.sampler.SampleIterator
      • cugraph_pyg.sampler.BaseDistributedSampler
      • cugraph_pyg.sampler.DistributedNeighborSampler
      • cugraph_pyg.sampler.sampler.SampleReader
      • cugraph_pyg.sampler.sampler.HomogeneousSampleReader
      • cugraph_pyg.sampler.sampler.HeterogeneousSampleReader
      • cugraph_pyg.sampler.io.BufferedSampleReader
  • WholeGraph API
    • pylibwholegraph API
      • Initialization
        • pylibwholegraph.torch.init
        • pylibwholegraph.torch.init_torch_env
        • pylibwholegraph.torch.init_torch_env_and_create_wm_comm
        • pylibwholegraph.torch.finalize
      • Communicators
        • pylibwholegraph.torch.WholeMemoryCommunicator
        • pylibwholegraph.torch.comm.set_world_info
        • pylibwholegraph.torch.create_group_communicator
        • pylibwholegraph.torch.split_communicator
        • pylibwholegraph.torch.destroy_communicator
        • pylibwholegraph.torch.get_global_communicator
        • pylibwholegraph.torch.get_local_node_communicator
        • pylibwholegraph.torch.get_local_device_communicator
        • pylibwholegraph.torch.get_local_mnnvl_communicator
        • pylibwholegraph.torch.comm.comm_set_distributed_backend
      • Tensors
        • pylibwholegraph.torch.WholeMemoryTensor
        • pylibwholegraph.torch.create_wholememory_tensor
        • pylibwholegraph.torch.create_wholememory_tensor_from_filelist
        • pylibwholegraph.torch.destroy_wholememory_tensor
      • Embeddings and optimizers
        • pylibwholegraph.torch.WholeMemoryOptimizer
        • pylibwholegraph.torch.create_wholememory_optimizer
        • pylibwholegraph.torch.destroy_wholememory_optimizer
        • pylibwholegraph.torch.WholeMemoryCachePolicy
        • pylibwholegraph.torch.create_wholememory_cache_policy
        • pylibwholegraph.torch.create_builtin_cache_policy
        • pylibwholegraph.torch.destroy_wholememory_cache_policy
        • pylibwholegraph.torch.WholeMemoryEmbedding
        • pylibwholegraph.torch.create_embedding
        • pylibwholegraph.torch.create_embedding_from_filelist
        • pylibwholegraph.torch.destroy_embedding
        • pylibwholegraph.torch.WholeMemoryEmbeddingModule
      • Graph storage and operations
        • pylibwholegraph.torch.GraphStructure
        • pylibwholegraph.torch.graph_ops.append_unique
        • pylibwholegraph.torch.graph_ops.add_csr_self_loop
        • pylibwholegraph.torch.wholegraph_ops.unweighted_sample_without_replacement
        • pylibwholegraph.torch.wholegraph_ops.weighted_sample_without_replacement
      • Distributed launch
        • pylibwholegraph.torch.add_distributed_launch_options
        • pylibwholegraph.torch.distributed_launch
        • pylibwholegraph.torch.get_rank
        • pylibwholegraph.torch.get_world_size
        • pylibwholegraph.torch.get_local_rank
        • pylibwholegraph.torch.get_local_size
      • Training and data-loading helpers
        • pylibwholegraph.torch.add_common_graph_options
        • pylibwholegraph.torch.add_common_model_options
        • pylibwholegraph.torch.add_common_sampler_options
        • pylibwholegraph.torch.add_training_options
        • pylibwholegraph.torch.add_dataloader_options
        • pylibwholegraph.torch.add_node_classfication_options
        • pylibwholegraph.torch.set_framework
        • pylibwholegraph.torch.create_gnn_layers
        • pylibwholegraph.torch.create_sub_graph
        • pylibwholegraph.torch.HomoGNNModel
        • pylibwholegraph.torch.create_node_classification_datasets
        • pylibwholegraph.torch.get_train_dataloader
        • pylibwholegraph.torch.get_valid_test_dataloader
        • pylibwholegraph.torch.compile_cpp_extension
        • pylibwholegraph.torch.get_part_file_name
        • pylibwholegraph.torch.get_part_file_list
    • libwholegraph API
      • Initialization, communicators, and memory
      • Tensor descriptions and handles
      • Tensor and graph operations
      • Embeddings
      • Environment callbacks

Core Libraries

  • libcuGraph API
    • libcugraph_c API
      • Core types and resources
      • Graph construction and utilities
      • Centrality
      • Community
      • Core
      • Components
      • Layout
      • Sampling
      • Similarity
      • Traversal
      • Tree algorithms
    • libcuGraph C++ API
      • Algorithms
        • Centrality
        • Community
        • Components
        • Directed acyclic graph algorithms
        • Sampling
        • Similarity
        • Traversal
        • Linear
        • Link Analysis
        • Layout
        • Tree
        • Utility Functions
      • Graph Functions
      • Graph Generators
      • Sampling Functions
      • Shuffle functions
      • Collection Wrappers
      • Graph Utility Wrappers
      • Legacy Graph Functions
      • Complete C++ namespace reference
    • libcuGraph primitives API
      • count_if_e.cuh
      • extract_transform_e.cuh
      • extract_transform_if_e.cuh
      • transform_e.cuh
      • transform_gather_e.cuh
      • transform_reduce_e.cuh
      • transform_reduce_e_by_src_dst_key.cuh
      • count_if_v.cuh
      • reduce_v.cuh
      • transform_reduce_v.cuh
      • edge_bucket.cuh
      • vertex_frontier.cuh
      • update_v_frontier.cuh
      • extract_transform_if_v_frontier_incoming_outgoing_e.cuh
      • extract_transform_v_frontier_incoming_outgoing_e.cuh
      • transform_reduce_if_v_frontier_outgoing_e_by_dst.cuh
      • transform_reduce_v_frontier_outgoing_e_by_dst.cuh
      • per_v_pair_src_dst_nbr_intersection.cuh
      • per_v_pair_transform_src_dst_nbr_intersection.cuh
      • per_v_random_select_transform_outgoing_e.cuh
      • per_v_transform_reduce_dst_key_aggregated_outgoing_e.cuh
      • per_v_transform_reduce_if_incoming_outgoing_e.cuh
      • per_v_transform_reduce_incoming_outgoing_e.cuh
      • transform_reduce_src_dst_nbr_intersection_of_e_endpoints_by_v.cuh
      • fill_edge_property.cuh
      • fill_edge_src_dst_property.cuh
      • make_initialized_edge_property.cuh
      • make_initialized_edge_src_dst_property.cuh
      • update_edge_src_dst_property.cuh
      • property_op_utils.cuh
      • key_store.cuh
      • kv_store.cuh
      • reduce_op.cuh
    • libcugraph_etl API
  • API Reference
  • cuGraph-PyG API
  • Samplers
  • cugraph_pyg.sampler.BaseSampler

cugraph_pyg.sampler.BaseSampler#

class cugraph_pyg.sampler.BaseSampler(
sampler: DistributedNeighborSampler,
data: Tuple[FeatureStore, GraphStore],
batch_size: int = 16,
)[source]#

Methods

sample_from_edges

sample_from_nodes

__init__(
sampler: DistributedNeighborSampler,
data: Tuple[FeatureStore, GraphStore],
batch_size: int = 16,
)[source]#

Methods

__init__(sampler, data[, batch_size])

sample_from_edges(index[, neg_sampling])

sample_from_nodes(index, **kwargs)

previous

Samplers

next

cugraph_pyg.sampler.SampleIterator

On this page
  • BaseSampler
    • __init__()
NVIDIA NVIDIA
Privacy Policy | Your Privacy Choices | Terms of Service | Accessibility | Corporate Policies | Product Security | Contact

Copyright © 2024-2026, NVIDIA Corporation.