pub struct Graph<T = Forward> { /* private fields */ }Expand description
RAII wrapper for a cuGraph graph object.
The type parameter T encodes the transposition state of the graph:
Forward: stored in forward (non-transposed) form (the default)Transposed: stored in transposed form
Use GraphBuilder::build::<Forward> or
GraphBuilder::build::<Transposed> to construct a
graph with the appropriate type state.
The graph carries runtime dtype information for its vertex IDs
(vertex_dtype) and edge weights
(weight_dtype), enabling downstream code to
interpret algorithm results without guessing.
When a graph is constructed or operated on with a
ResourceHandle created by
ResourceHandle::for_runtime,
the graph retains a private lease on that runtime-bound native handle until
the graph is dropped. This keeps native graph teardown safe when cuGraph
records allocations or RAFT-side state associated with the runtime-bound
handle used by construction or later algorithms.
Implementations§
Source§impl Graph<Transposed>
impl Graph<Transposed>
Sourcepub fn pagerank(
&mut self,
handle: &EnteredContext<'_>,
params: &PageRankParams,
) -> Result<CentralityResult>
pub fn pagerank( &mut self, handle: &EnteredContext<'_>, params: &PageRankParams, ) -> Result<CentralityResult>
Compute PageRank on this transposed graph.
Returns a CentralityResult
containing vertex ids, scores, iteration count, and convergence status.
Runs PageRank without auxiliary input arrays. For precomputed weights
or initial scores, see pagerank_with.
Sourcepub fn pagerank_with<V: CugraphElement, W: CugraphElement>(
&mut self,
handle: &EnteredContext<'_>,
params: &PageRankParams,
precomputed_weights: Option<&PrecomputedWeights<'_, V, W>>,
initial_guess: Option<&InitialGuess<'_, V, W>>,
) -> Result<CentralityResult>
pub fn pagerank_with<V: CugraphElement, W: CugraphElement>( &mut self, handle: &EnteredContext<'_>, params: &PageRankParams, precomputed_weights: Option<&PrecomputedWeights<'_, V, W>>, initial_guess: Option<&InitialGuess<'_, V, W>>, ) -> Result<CentralityResult>
Compute PageRank with optional precomputed weights and/or initial guess.
Accepts precomputed out-weight sums and initial score guesses for iterative refinement.
Sourcepub fn personalized_pagerank<V: CugraphElement, W: CugraphElement>(
&mut self,
handle: &EnteredContext<'_>,
params: &PersonalizedPageRankParams,
personalization: &PersonalizationVector<'_, V, W>,
) -> Result<CentralityResult>
pub fn personalized_pagerank<V: CugraphElement, W: CugraphElement>( &mut self, handle: &EnteredContext<'_>, params: &PersonalizedPageRankParams, personalization: &PersonalizationVector<'_, V, W>, ) -> Result<CentralityResult>
Compute personalized PageRank using the allow-nonconvergence native API.
Sourcepub fn personalized_pagerank_with<V: CugraphElement, W: CugraphElement>(
&mut self,
handle: &EnteredContext<'_>,
params: &PersonalizedPageRankParams,
personalization: &PersonalizationVector<'_, V, W>,
precomputed_weights: Option<&PrecomputedWeights<'_, V, W>>,
initial_guess: Option<&InitialGuess<'_, V, W>>,
) -> Result<CentralityResult>
pub fn personalized_pagerank_with<V: CugraphElement, W: CugraphElement>( &mut self, handle: &EnteredContext<'_>, params: &PersonalizedPageRankParams, personalization: &PersonalizationVector<'_, V, W>, precomputed_weights: Option<&PrecomputedWeights<'_, V, W>>, initial_guess: Option<&InitialGuess<'_, V, W>>, ) -> Result<CentralityResult>
Compute personalized PageRank with optional precomputed weights and/or initial guess.
Sourcepub fn eigenvector_centrality(
&mut self,
handle: &EnteredContext<'_>,
params: &EigenvectorCentralityParams,
) -> Result<CentralityResult>
pub fn eigenvector_centrality( &mut self, handle: &EnteredContext<'_>, params: &EigenvectorCentralityParams, ) -> Result<CentralityResult>
Compute eigenvector centrality.
Sourcepub fn katz_centrality(
&mut self,
handle: &EnteredContext<'_>,
params: &KatzCentralityParams,
) -> Result<CentralityResult>
pub fn katz_centrality( &mut self, handle: &EnteredContext<'_>, params: &KatzCentralityParams, ) -> Result<CentralityResult>
Compute Katz centrality using a scalar beta value.
The local cuGraph C API accepts a per-vertex beta array parameter, but the current implementation does not forward it to the native algorithm. This safe method therefore exposes only the scalar-beta path.
Sourcepub fn hits(
&mut self,
handle: &EnteredContext<'_>,
params: &HitsParams,
) -> Result<HitsResult>
pub fn hits( &mut self, handle: &EnteredContext<'_>, params: &HitsParams, ) -> Result<HitsResult>
Compute HITS hub and authority scores.
Sourcepub fn hits_with_initial_hubs<V: CugraphElement, W: CugraphElement>(
&mut self,
handle: &EnteredContext<'_>,
params: &HitsParams,
initial_hubs: Option<&HitsInitialHubs<'_, V, W>>,
) -> Result<HitsResult>
pub fn hits_with_initial_hubs<V: CugraphElement, W: CugraphElement>( &mut self, handle: &EnteredContext<'_>, params: &HitsParams, initial_hubs: Option<&HitsInitialHubs<'_, V, W>>, ) -> Result<HitsResult>
Compute HITS hub and authority scores with an optional initial hub guess.
Sourcepub fn degrees<'a, V: CugraphElement + 'a>(
&mut self,
handle: &EnteredContext<'_>,
vertices: impl Into<VertexSelection<'a, V>>,
) -> Result<DegreesResult>
pub fn degrees<'a, V: CugraphElement + 'a>( &mut self, handle: &EnteredContext<'_>, vertices: impl Into<VertexSelection<'a, V>>, ) -> Result<DegreesResult>
Compute both in-degrees and out-degrees for vertices in this graph.
Pass VertexSelection::All to compute degrees for every vertex,
VertexSelection::Device with a device view, or
VertexSelection::Host with a host slice (uploaded on demand).
§Errors
Returns ErrorKind::UnsupportedType if vertices uses a vertex
dtype that does not match the graph.
Sourcepub fn degrees_checked<'a, V: CugraphElement + 'a>(
&mut self,
handle: &EnteredContext<'_>,
vertices: impl Into<VertexSelection<'a, V>>,
do_expensive_check: bool,
) -> Result<DegreesResult>
pub fn degrees_checked<'a, V: CugraphElement + 'a>( &mut self, handle: &EnteredContext<'_>, vertices: impl Into<VertexSelection<'a, V>>, do_expensive_check: bool, ) -> Result<DegreesResult>
Compute degrees with optional expensive input validation.
Sourcepub fn degrees_all(
&mut self,
handle: &EnteredContext<'_>,
) -> Result<DegreesResult>
pub fn degrees_all( &mut self, handle: &EnteredContext<'_>, ) -> Result<DegreesResult>
Compute degrees for every vertex in the graph.
Sourcepub fn in_degrees<'a, V: CugraphElement + 'a>(
&mut self,
handle: &EnteredContext<'_>,
vertices: impl Into<VertexSelection<'a, V>>,
) -> Result<InDegreesResult>
pub fn in_degrees<'a, V: CugraphElement + 'a>( &mut self, handle: &EnteredContext<'_>, vertices: impl Into<VertexSelection<'a, V>>, ) -> Result<InDegreesResult>
Compute only in-degrees for vertices in this graph.
Pass VertexSelection::All to compute degrees for every vertex,
VertexSelection::Device with a device view, or
VertexSelection::Host with a host slice (uploaded on demand).
§Errors
Returns ErrorKind::UnsupportedType if vertices uses a vertex
dtype that does not match the graph.
Sourcepub fn in_degrees_checked<'a, V: CugraphElement + 'a>(
&mut self,
handle: &EnteredContext<'_>,
vertices: impl Into<VertexSelection<'a, V>>,
do_expensive_check: bool,
) -> Result<InDegreesResult>
pub fn in_degrees_checked<'a, V: CugraphElement + 'a>( &mut self, handle: &EnteredContext<'_>, vertices: impl Into<VertexSelection<'a, V>>, do_expensive_check: bool, ) -> Result<InDegreesResult>
Compute in-degrees with optional expensive input validation.
Sourcepub fn in_degrees_all(
&mut self,
handle: &EnteredContext<'_>,
) -> Result<InDegreesResult>
pub fn in_degrees_all( &mut self, handle: &EnteredContext<'_>, ) -> Result<InDegreesResult>
Compute in-degrees for every vertex in the graph.
Source§impl Graph<Forward>
impl Graph<Forward>
Sourcepub fn bfs<'a, V: CugraphElement + 'a>(
&mut self,
handle: &EnteredContext<'_>,
sources: impl Into<VertexSelection<'a, V>>,
params: &BfsParams,
) -> Result<BfsResult>
pub fn bfs<'a, V: CugraphElement + 'a>( &mut self, handle: &EnteredContext<'_>, sources: impl Into<VertexSelection<'a, V>>, params: &BfsParams, ) -> Result<BfsResult>
Perform breadth-first search from one or more source vertices.
Returns a BfsResult containing vertex
ids, distances, and optionally predecessors.
§Errors
Returns ErrorKind::UnsupportedType if sources uses a vertex
dtype that does not match the graph.
Sourcepub fn bfs_with_predicates<'a, V, E>(
&mut self,
handle: &EnteredContext<'_>,
sources: impl Into<VertexSelection<'a, V>>,
params: &BfsParams,
predicates: &BfsPredicateParams<'a, V, E>,
) -> Result<BfsResult>where
V: CugraphElement + 'a,
E: CugraphElement + 'a,
pub fn bfs_with_predicates<'a, V, E>(
&mut self,
handle: &EnteredContext<'_>,
sources: impl Into<VertexSelection<'a, V>>,
params: &BfsParams,
predicates: &BfsPredicateParams<'a, V, E>,
) -> Result<BfsResult>where
V: CugraphElement + 'a,
E: CugraphElement + 'a,
Perform breadth-first search with optional edge, vertex, and target predicates.
Predicate inputs must already be concrete device arrays. Higher layers are responsible for SQL planning, relation-backed edge alignment, and logical-to-physical vertex-id mapping before calling this API.
Sourcepub fn sssp<V>(
&mut self,
handle: &EnteredContext<'_>,
source: V,
params: &SsspParams,
) -> Result<SsspResult>
pub fn sssp<V>( &mut self, handle: &EnteredContext<'_>, source: V, params: &SsspParams, ) -> Result<SsspResult>
Perform single-source shortest path from one source vertex.
Returns an SsspResult containing
vertex ids, weighted distances, and optionally predecessors.
Sourcepub fn uniform_random_walks<V: CugraphElement>(
&mut self,
handle: &EnteredContext<'_>,
rng_state: &mut RngState,
start_vertices: &DeviceArrayView<'_, V>,
params: &RandomWalkParams,
) -> Result<RandomWalkResult>
pub fn uniform_random_walks<V: CugraphElement>( &mut self, handle: &EnteredContext<'_>, rng_state: &mut RngState, start_vertices: &DeviceArrayView<'_, V>, params: &RandomWalkParams, ) -> Result<RandomWalkResult>
Compute uniform random walks from explicit start vertices.
Sourcepub fn biased_random_walks<V: CugraphElement>(
&mut self,
handle: &EnteredContext<'_>,
rng_state: &mut RngState,
start_vertices: &DeviceArrayView<'_, V>,
params: &RandomWalkParams,
) -> Result<RandomWalkResult>
pub fn biased_random_walks<V: CugraphElement>( &mut self, handle: &EnteredContext<'_>, rng_state: &mut RngState, start_vertices: &DeviceArrayView<'_, V>, params: &RandomWalkParams, ) -> Result<RandomWalkResult>
Compute biased random walks from explicit start vertices.
Sourcepub fn node2vec_random_walks<V: CugraphElement>(
&mut self,
handle: &EnteredContext<'_>,
rng_state: &mut RngState,
start_vertices: &DeviceArrayView<'_, V>,
params: &Node2VecRandomWalkParams,
) -> Result<RandomWalkResult>
pub fn node2vec_random_walks<V: CugraphElement>( &mut self, handle: &EnteredContext<'_>, rng_state: &mut RngState, start_vertices: &DeviceArrayView<'_, V>, params: &Node2VecRandomWalkParams, ) -> Result<RandomWalkResult>
Compute node2vec random walks from explicit start vertices.
Sourcepub fn homogeneous_uniform_neighbor_sample<V: CugraphElement>(
&mut self,
handle: &EnteredContext<'_>,
rng_state: &mut RngState,
start_vertices: &DeviceArrayView<'_, V>,
starting_vertex_label_offsets: Option<&DeviceArrayView<'_, usize>>,
params: &NeighborSamplingParams,
) -> Result<SampleResult>
pub fn homogeneous_uniform_neighbor_sample<V: CugraphElement>( &mut self, handle: &EnteredContext<'_>, rng_state: &mut RngState, start_vertices: &DeviceArrayView<'_, V>, starting_vertex_label_offsets: Option<&DeviceArrayView<'_, usize>>, params: &NeighborSamplingParams, ) -> Result<SampleResult>
Sample homogeneous neighborhoods uniformly from explicit start vertices.
Sourcepub fn homogeneous_biased_neighbor_sample<V: CugraphElement>(
&mut self,
handle: &EnteredContext<'_>,
rng_state: &mut RngState,
start_vertices: &DeviceArrayView<'_, V>,
starting_vertex_label_offsets: Option<&DeviceArrayView<'_, usize>>,
params: &NeighborSamplingParams,
) -> Result<SampleResult>
pub fn homogeneous_biased_neighbor_sample<V: CugraphElement>( &mut self, handle: &EnteredContext<'_>, rng_state: &mut RngState, start_vertices: &DeviceArrayView<'_, V>, starting_vertex_label_offsets: Option<&DeviceArrayView<'_, usize>>, params: &NeighborSamplingParams, ) -> Result<SampleResult>
Sample homogeneous neighborhoods with biased sampling from explicit start vertices.
Sourcepub fn homogeneous_uniform_temporal_neighbor_sample<V, Tm>(
&mut self,
handle: &EnteredContext<'_>,
rng_state: &mut RngState,
temporal_property_name: &str,
start_vertices: &DeviceArrayView<'_, V>,
starting_vertex_times: Option<&DeviceArrayView<'_, Tm>>,
starting_vertex_label_offsets: Option<&DeviceArrayView<'_, usize>>,
params: &NeighborSamplingParams,
) -> Result<SampleResult>where
V: CugraphElement,
Tm: CugraphElement,
pub fn homogeneous_uniform_temporal_neighbor_sample<V, Tm>(
&mut self,
handle: &EnteredContext<'_>,
rng_state: &mut RngState,
temporal_property_name: &str,
start_vertices: &DeviceArrayView<'_, V>,
starting_vertex_times: Option<&DeviceArrayView<'_, Tm>>,
starting_vertex_label_offsets: Option<&DeviceArrayView<'_, usize>>,
params: &NeighborSamplingParams,
) -> Result<SampleResult>where
V: CugraphElement,
Tm: CugraphElement,
Sample homogeneous temporal neighborhoods uniformly from explicit start vertices.
Sourcepub fn homogeneous_biased_temporal_neighbor_sample<V, Tm>(
&mut self,
handle: &EnteredContext<'_>,
rng_state: &mut RngState,
temporal_property_name: &str,
start_vertices: &DeviceArrayView<'_, V>,
starting_vertex_times: Option<&DeviceArrayView<'_, Tm>>,
starting_vertex_label_offsets: Option<&DeviceArrayView<'_, usize>>,
params: &NeighborSamplingParams,
) -> Result<SampleResult>where
V: CugraphElement,
Tm: CugraphElement,
pub fn homogeneous_biased_temporal_neighbor_sample<V, Tm>(
&mut self,
handle: &EnteredContext<'_>,
rng_state: &mut RngState,
temporal_property_name: &str,
start_vertices: &DeviceArrayView<'_, V>,
starting_vertex_times: Option<&DeviceArrayView<'_, Tm>>,
starting_vertex_label_offsets: Option<&DeviceArrayView<'_, usize>>,
params: &NeighborSamplingParams,
) -> Result<SampleResult>where
V: CugraphElement,
Tm: CugraphElement,
Sample homogeneous temporal neighborhoods with biased sampling from explicit start vertices.
Sourcepub fn louvain(
&mut self,
handle: &EnteredContext<'_>,
params: &LouvainParams,
) -> Result<LouvainResult>
pub fn louvain( &mut self, handle: &EnteredContext<'_>, params: &LouvainParams, ) -> Result<LouvainResult>
Compute Louvain communities on this forward-stored graph.
Louvain is an undirected community-detection algorithm. This wrapper preserves the crate’s type-state requirement that the graph must be stored in forward (non-transposed) layout, but it does not add a new Rust-side hard check that the graph was constructed with undirected properties.
Returns a LouvainResult
containing vertex ids, per-vertex partitions, and modularity.
Sourcepub fn leiden(
&mut self,
handle: &EnteredContext<'_>,
rng_state: &mut RngState,
params: &LeidenParams,
) -> Result<LeidenResult>
pub fn leiden( &mut self, handle: &EnteredContext<'_>, rng_state: &mut RngState, params: &LeidenParams, ) -> Result<LeidenResult>
Compute Leiden communities on this forward-stored graph.
Leiden is an undirected community-detection algorithm. This wrapper
requires forward graph storage; libcugraph rejects a directed graph as
ErrorKind::InvalidInput. Every
returned community induces a connected subgraph, and the reported
modularity is that of the returned partition.
Sourcepub fn ecg(
&mut self,
handle: &EnteredContext<'_>,
rng_state: &mut RngState,
params: &EcgParams,
) -> Result<EcgResult>
pub fn ecg( &mut self, handle: &EnteredContext<'_>, rng_state: &mut RngState, params: &EcgParams, ) -> Result<EcgResult>
Compute ECG communities on this forward-stored graph.
ECG is an undirected community-detection algorithm built from a Louvain ensemble. This wrapper requires forward graph storage but leaves graph-property validation to the native library.
Sourcepub fn spectral_modularity_maximization(
&mut self,
handle: &EnteredContext<'_>,
rng_state: &mut RngState,
params: &SpectralClusteringParams,
) -> Result<SpectralClusteringResult>
pub fn spectral_modularity_maximization( &mut self, handle: &EnteredContext<'_>, rng_state: &mut RngState, params: &SpectralClusteringParams, ) -> Result<SpectralClusteringResult>
Compute legacy spectral modularity maximization clusters.
cuGraph requires a symmetric graph for this algorithm. This wrapper keeps that validation in the native library, matching the rest of the community-detection surface.
Sourcepub fn analyze_clustering_modularity<V: CugraphElement>(
&mut self,
handle: &EnteredContext<'_>,
n_clusters: NonZeroUsize,
vertices: &DeviceArrayView<'_, V>,
clusters: &DeviceArrayView<'_, V>,
) -> Result<f64>
pub fn analyze_clustering_modularity<V: CugraphElement>( &mut self, handle: &EnteredContext<'_>, n_clusters: NonZeroUsize, vertices: &DeviceArrayView<'_, V>, clusters: &DeviceArrayView<'_, V>, ) -> Result<f64>
Compute modularity for explicit clustering columns.
Sourcepub fn analyze_clustering_edge_cut<V: CugraphElement>(
&mut self,
handle: &EnteredContext<'_>,
n_clusters: NonZeroUsize,
vertices: &DeviceArrayView<'_, V>,
clusters: &DeviceArrayView<'_, V>,
) -> Result<f64>
pub fn analyze_clustering_edge_cut<V: CugraphElement>( &mut self, handle: &EnteredContext<'_>, n_clusters: NonZeroUsize, vertices: &DeviceArrayView<'_, V>, clusters: &DeviceArrayView<'_, V>, ) -> Result<f64>
Compute edge cut for explicit clustering columns.
Sourcepub fn analyze_clustering_ratio_cut<V: CugraphElement>(
&mut self,
handle: &EnteredContext<'_>,
n_clusters: NonZeroUsize,
vertices: &DeviceArrayView<'_, V>,
clusters: &DeviceArrayView<'_, V>,
) -> Result<f64>
pub fn analyze_clustering_ratio_cut<V: CugraphElement>( &mut self, handle: &EnteredContext<'_>, n_clusters: NonZeroUsize, vertices: &DeviceArrayView<'_, V>, clusters: &DeviceArrayView<'_, V>, ) -> Result<f64>
Compute ratio cut for explicit clustering columns.
Source§impl<T: Transposition> Graph<T>
impl<T: Transposition> Graph<T>
Sourcepub fn betweenness_centrality<'a, V: CugraphElement + 'a>(
&mut self,
handle: &EnteredContext<'_>,
vertex_list: impl Into<VertexSelection<'a, V>>,
params: &BetweennessCentralityParams,
) -> Result<BetweennessCentralityResult>
pub fn betweenness_centrality<'a, V: CugraphElement + 'a>( &mut self, handle: &EnteredContext<'_>, vertex_list: impl Into<VertexSelection<'a, V>>, params: &BetweennessCentralityParams, ) -> Result<BetweennessCentralityResult>
Compute vertex betweenness centrality on this graph.
Pass VertexSelection::All for exact computation, or provide seed
vertices for approximate computation via VertexSelection::Device or
VertexSelection::Host.
§Errors
Returns ErrorKind::UnsupportedType if vertex_list uses a vertex
dtype that does not match the graph.
Sourcepub fn betweenness_centrality_all(
&mut self,
handle: &EnteredContext<'_>,
params: &BetweennessCentralityParams,
) -> Result<BetweennessCentralityResult>
pub fn betweenness_centrality_all( &mut self, handle: &EnteredContext<'_>, params: &BetweennessCentralityParams, ) -> Result<BetweennessCentralityResult>
Compute exact betweenness centrality over all vertices.
Sourcepub fn edge_betweenness_centrality<'a, V: CugraphElement + 'a>(
&mut self,
handle: &EnteredContext<'_>,
vertex_list: impl Into<VertexSelection<'a, V>>,
params: &EdgeBetweennessCentralityParams,
) -> Result<EdgeBetweennessCentralityResult>
pub fn edge_betweenness_centrality<'a, V: CugraphElement + 'a>( &mut self, handle: &EnteredContext<'_>, vertex_list: impl Into<VertexSelection<'a, V>>, params: &EdgeBetweennessCentralityParams, ) -> Result<EdgeBetweennessCentralityResult>
Compute edge betweenness centrality on this graph.
Pass VertexSelection::All for exact computation, or provide seed
vertices for approximate computation via VertexSelection::Device or
VertexSelection::Host.
Sourcepub fn edge_betweenness_centrality_all(
&mut self,
handle: &EnteredContext<'_>,
params: &EdgeBetweennessCentralityParams,
) -> Result<EdgeBetweennessCentralityResult>
pub fn edge_betweenness_centrality_all( &mut self, handle: &EnteredContext<'_>, params: &EdgeBetweennessCentralityParams, ) -> Result<EdgeBetweennessCentralityResult>
Compute exact edge betweenness centrality over all vertices.
Sourcepub fn weakly_connected_components(
&mut self,
handle: &EnteredContext<'_>,
params: &ConnectedComponentsParams,
) -> Result<LabelingResult>
pub fn weakly_connected_components( &mut self, handle: &EnteredContext<'_>, params: &ConnectedComponentsParams, ) -> Result<LabelingResult>
Compute weakly connected components.
cuGraph requires the input graph to be symmetric for this algorithm.
This wrapper does not add a Rust-side graph-property hard failure; use
do_expensive_check in ConnectedComponentsParams to request native
validation.
Sourcepub fn strongly_connected_components(
&mut self,
handle: &EnteredContext<'_>,
params: &ConnectedComponentsParams,
) -> Result<LabelingResult>
pub fn strongly_connected_components( &mut self, handle: &EnteredContext<'_>, params: &ConnectedComponentsParams, ) -> Result<LabelingResult>
Compute strongly connected components.
Sourcepub fn core_number(
&mut self,
handle: &EnteredContext<'_>,
params: &CoreNumberParams,
) -> Result<CoreNumberResult>
pub fn core_number( &mut self, handle: &EnteredContext<'_>, params: &CoreNumberParams, ) -> Result<CoreNumberResult>
Compute core numbers for all vertices.
Sourcepub fn k_core(
&mut self,
handle: &EnteredContext<'_>,
params: &KCoreParams,
) -> Result<KCoreResult>
pub fn k_core( &mut self, handle: &EnteredContext<'_>, params: &KCoreParams, ) -> Result<KCoreResult>
Extract a k-core subgraph, computing core numbers internally.
Sourcepub fn k_core_with_core_numbers(
&mut self,
handle: &EnteredContext<'_>,
params: &KCoreParams,
core_numbers: &CoreNumberResult,
) -> Result<KCoreResult>
pub fn k_core_with_core_numbers( &mut self, handle: &EnteredContext<'_>, params: &KCoreParams, core_numbers: &CoreNumberResult, ) -> Result<KCoreResult>
Extract a k-core subgraph using a precomputed core-number result.
Sourcepub fn minimum_spanning_tree(
&mut self,
handle: &EnteredContext<'_>,
params: &MinimumSpanningTreeParams,
) -> Result<MinimumSpanningTreeResult>
pub fn minimum_spanning_tree( &mut self, handle: &EnteredContext<'_>, params: &MinimumSpanningTreeParams, ) -> Result<MinimumSpanningTreeResult>
Compute a minimum spanning tree.
Sourcepub fn vertex_pairs<'a, V: CugraphElement + 'a>(
&mut self,
handle: &EnteredContext<'_>,
first: impl Into<VertexSelection<'a, V>>,
second: impl Into<VertexSelection<'a, V>>,
) -> Result<VertexPairs>
pub fn vertex_pairs<'a, V: CugraphElement + 'a>( &mut self, handle: &EnteredContext<'_>, first: impl Into<VertexSelection<'a, V>>, second: impl Into<VertexSelection<'a, V>>, ) -> Result<VertexPairs>
Create an owned vertex-pair collection for pairwise similarity algorithms.
first and second must be explicit vertex selections with matching
lengths and the same vertex dtype as this graph. VertexSelection::All
is rejected because pairwise similarity requires aligned input pairs.
Sourcepub fn jaccard_coefficients(
&mut self,
handle: &EnteredContext<'_>,
pairs: VertexPairs,
params: &SimilarityParams,
) -> Result<JaccardSimilarityResult>
pub fn jaccard_coefficients( &mut self, handle: &EnteredContext<'_>, pairs: VertexPairs, params: &SimilarityParams, ) -> Result<JaccardSimilarityResult>
Compute Jaccard similarity coefficients for explicit vertex pairs.
cuGraph requires a symmetric graph for this algorithm; native validation reports detailed graph-property errors.
Sourcepub fn sorensen_coefficients(
&mut self,
handle: &EnteredContext<'_>,
pairs: VertexPairs,
params: &SimilarityParams,
) -> Result<SorensenSimilarityResult>
pub fn sorensen_coefficients( &mut self, handle: &EnteredContext<'_>, pairs: VertexPairs, params: &SimilarityParams, ) -> Result<SorensenSimilarityResult>
Compute Sorensen similarity coefficients for explicit vertex pairs.
cuGraph requires a symmetric graph for this algorithm; native validation reports detailed graph-property errors.
Sourcepub fn overlap_coefficients(
&mut self,
handle: &EnteredContext<'_>,
pairs: VertexPairs,
params: &SimilarityParams,
) -> Result<OverlapSimilarityResult>
pub fn overlap_coefficients( &mut self, handle: &EnteredContext<'_>, pairs: VertexPairs, params: &SimilarityParams, ) -> Result<OverlapSimilarityResult>
Compute overlap similarity coefficients for explicit vertex pairs.
cuGraph requires a symmetric graph for this algorithm; native validation reports detailed graph-property errors.
Sourcepub fn cosine_similarity_coefficients(
&mut self,
handle: &EnteredContext<'_>,
pairs: VertexPairs,
params: &SimilarityParams,
) -> Result<CosineSimilarityResult>
pub fn cosine_similarity_coefficients( &mut self, handle: &EnteredContext<'_>, pairs: VertexPairs, params: &SimilarityParams, ) -> Result<CosineSimilarityResult>
Compute cosine similarity coefficients for explicit vertex pairs.
cuGraph requires a symmetric graph for this algorithm; native validation reports detailed graph-property errors.
Sourcepub fn all_pairs_jaccard_coefficients<'a, V: CugraphElement + 'a>(
&mut self,
handle: &EnteredContext<'_>,
vertices: impl Into<VertexSelection<'a, V>>,
params: &AllPairsSimilarityParams,
) -> Result<JaccardSimilarityResult>
pub fn all_pairs_jaccard_coefficients<'a, V: CugraphElement + 'a>( &mut self, handle: &EnteredContext<'_>, vertices: impl Into<VertexSelection<'a, V>>, params: &AllPairsSimilarityParams, ) -> Result<JaccardSimilarityResult>
Compute all-pairs Jaccard similarity coefficients.
Pass VertexSelection::All to use all vertices or an explicit subset
to seed pair generation. cuGraph requires a symmetric graph.
Sourcepub fn all_pairs_sorensen_coefficients<'a, V: CugraphElement + 'a>(
&mut self,
handle: &EnteredContext<'_>,
vertices: impl Into<VertexSelection<'a, V>>,
params: &AllPairsSimilarityParams,
) -> Result<SorensenSimilarityResult>
pub fn all_pairs_sorensen_coefficients<'a, V: CugraphElement + 'a>( &mut self, handle: &EnteredContext<'_>, vertices: impl Into<VertexSelection<'a, V>>, params: &AllPairsSimilarityParams, ) -> Result<SorensenSimilarityResult>
Compute all-pairs Sorensen similarity coefficients.
Pass VertexSelection::All to use all vertices or an explicit subset
to seed pair generation. cuGraph requires a symmetric graph.
Sourcepub fn all_pairs_overlap_coefficients<'a, V: CugraphElement + 'a>(
&mut self,
handle: &EnteredContext<'_>,
vertices: impl Into<VertexSelection<'a, V>>,
params: &AllPairsSimilarityParams,
) -> Result<OverlapSimilarityResult>
pub fn all_pairs_overlap_coefficients<'a, V: CugraphElement + 'a>( &mut self, handle: &EnteredContext<'_>, vertices: impl Into<VertexSelection<'a, V>>, params: &AllPairsSimilarityParams, ) -> Result<OverlapSimilarityResult>
Compute all-pairs overlap similarity coefficients.
Pass VertexSelection::All to use all vertices or an explicit subset
to seed pair generation. cuGraph requires a symmetric graph.
Sourcepub fn all_pairs_cosine_similarity_coefficients<'a, V: CugraphElement + 'a>(
&mut self,
handle: &EnteredContext<'_>,
vertices: impl Into<VertexSelection<'a, V>>,
params: &AllPairsSimilarityParams,
) -> Result<CosineSimilarityResult>
pub fn all_pairs_cosine_similarity_coefficients<'a, V: CugraphElement + 'a>( &mut self, handle: &EnteredContext<'_>, vertices: impl Into<VertexSelection<'a, V>>, params: &AllPairsSimilarityParams, ) -> Result<CosineSimilarityResult>
Compute all-pairs cosine similarity coefficients.
Pass VertexSelection::All to use all vertices or an explicit subset
to seed pair generation. cuGraph requires a symmetric graph.
Sourcepub fn force_atlas2(
&mut self,
handle: &EnteredContext<'_>,
rng_state: &mut RngState,
params: &ForceAtlas2Params,
) -> Result<LayoutResult>
pub fn force_atlas2( &mut self, handle: &EnteredContext<'_>, rng_state: &mut RngState, params: &ForceAtlas2Params, ) -> Result<LayoutResult>
Compute a Force Atlas 2 layout for this graph.
Returns a LayoutResult containing
vertex ids and (x, y) coordinates.
For advanced features (per-vertex mass/radius, initial positions for
refinement passes), use force_atlas2_with.
Sourcepub fn force_atlas2_with<V: CugraphElement, W: CugraphElement>(
&mut self,
handle: &EnteredContext<'_>,
rng_state: &mut RngState,
params: &ForceAtlas2Params,
vertex_attrs: Option<&ForceAtlas2VertexAttrs<'_, V, W>>,
initial_positions: Option<&InitialPositions<'_, V, W>>,
) -> Result<LayoutResult>
pub fn force_atlas2_with<V: CugraphElement, W: CugraphElement>( &mut self, handle: &EnteredContext<'_>, rng_state: &mut RngState, params: &ForceAtlas2Params, vertex_attrs: Option<&ForceAtlas2VertexAttrs<'_, V, W>>, initial_positions: Option<&InitialPositions<'_, V, W>>, ) -> Result<LayoutResult>
Compute a Force Atlas 2 layout with optional per-vertex attributes and/or initial positions.
Accepts initial positions for refinement passes or per-vertex radius, mobility, and mass attributes.
Sourcepub fn out_degrees<'a, V: CugraphElement + 'a>(
&mut self,
handle: &EnteredContext<'_>,
vertices: impl Into<VertexSelection<'a, V>>,
) -> Result<OutDegreesResult>
pub fn out_degrees<'a, V: CugraphElement + 'a>( &mut self, handle: &EnteredContext<'_>, vertices: impl Into<VertexSelection<'a, V>>, ) -> Result<OutDegreesResult>
Compute only out-degrees for vertices in this graph.
Pass VertexSelection::All to compute degrees for every vertex,
VertexSelection::Device with a device view, or
VertexSelection::Host with a host slice (uploaded on demand).
§Errors
Returns ErrorKind::UnsupportedType if vertices uses a vertex
dtype that does not match the graph.
Sourcepub fn out_degrees_checked<'a, V: CugraphElement + 'a>(
&mut self,
handle: &EnteredContext<'_>,
vertices: impl Into<VertexSelection<'a, V>>,
do_expensive_check: bool,
) -> Result<OutDegreesResult>
pub fn out_degrees_checked<'a, V: CugraphElement + 'a>( &mut self, handle: &EnteredContext<'_>, vertices: impl Into<VertexSelection<'a, V>>, do_expensive_check: bool, ) -> Result<OutDegreesResult>
Compute out-degrees with optional expensive input validation.
Sourcepub fn out_degrees_all(
&mut self,
handle: &EnteredContext<'_>,
) -> Result<OutDegreesResult>
pub fn out_degrees_all( &mut self, handle: &EnteredContext<'_>, ) -> Result<OutDegreesResult>
Compute out-degrees for every vertex in the graph.
Sourcepub fn triangle_count<'a, V: CugraphElement + 'a>(
&mut self,
handle: &EnteredContext<'_>,
start_vertices: impl Into<VertexSelection<'a, V>>,
params: &TriangleCountParams,
) -> Result<TriangleCountResult>
pub fn triangle_count<'a, V: CugraphElement + 'a>( &mut self, handle: &EnteredContext<'_>, start_vertices: impl Into<VertexSelection<'a, V>>, params: &TriangleCountParams, ) -> Result<TriangleCountResult>
Compute triangle counts for all vertices or an explicit start-vertex list.
Pass VertexSelection::All to count triangles for every vertex,
VertexSelection::Device with a device view, or
VertexSelection::Host with a host slice uploaded on demand.
§Errors
Returns ErrorKind::UnsupportedType if start_vertices uses a
vertex dtype that does not match the graph.
Sourcepub fn triangle_count_all(
&mut self,
handle: &EnteredContext<'_>,
params: &TriangleCountParams,
) -> Result<TriangleCountResult>
pub fn triangle_count_all( &mut self, handle: &EnteredContext<'_>, params: &TriangleCountParams, ) -> Result<TriangleCountResult>
Compute triangle counts for every vertex in the graph.
Sourcepub fn k_truss_subgraph(
&mut self,
handle: &EnteredContext<'_>,
params: &KTrussSubgraphParams,
) -> Result<KTrussSubgraphResult>
pub fn k_truss_subgraph( &mut self, handle: &EnteredContext<'_>, params: &KTrussSubgraphParams, ) -> Result<KTrussSubgraphResult>
Extract a k-truss subgraph.
Sourcepub fn extract_ego<'a, V: CugraphElement + 'a>(
&mut self,
handle: &EnteredContext<'_>,
source_vertices: impl Into<VertexSelection<'a, V>>,
params: &ExtractEgoParams,
) -> Result<ExtractEgoResult>
pub fn extract_ego<'a, V: CugraphElement + 'a>( &mut self, handle: &EnteredContext<'_>, source_vertices: impl Into<VertexSelection<'a, V>>, params: &ExtractEgoParams, ) -> Result<ExtractEgoResult>
Extract ego subgraphs for explicit source vertices.
VertexSelection::All is rejected because the native API requires an
explicit source vertex list.
Source§impl<T> Graph<T>
impl<T> Graph<T>
Sourcepub fn vertex_dtype(&self) -> DataType
pub fn vertex_dtype(&self) -> DataType
The data type of vertex IDs in this graph (Int32 or Int64).
Sourcepub fn weight_dtype(&self) -> DataType
pub fn weight_dtype(&self) -> DataType
The data type of edge weights in this graph (Float32 or Float64).
For unweighted graphs, this defaults to Float32.
Sourcepub fn synchronize_input_reads(&mut self) -> Result<()>
pub fn synchronize_input_reads(&mut self) -> Result<()>
Waits for graph construction to finish reading prepared inputs and releases their retained producer owners.
Prepared construction remains asynchronous until this boundary, parking, or graph destruction. This method waits on the construction completion witnesses; it does not wait for algorithm work submitted afterward. On failure, unfinished witnesses and their owners remain retained.
Sourcepub fn park(self, handle: &EnteredContext<'_>) -> Result<ParkedGraph<T>>where
T: Send,
pub fn park(self, handle: &EnteredContext<'_>) -> Result<ParkedGraph<T>>where
T: Send,
Park this graph for transfer to another Rust thread.
Parking consumes the non-Send Graph and returns a ParkedGraph
that is Send but not Sync. The graph must have been built and used
only through runtime-bound handles for the same exact cudf execution
binding as handle; otherwise a single park event cannot prove all
graph work is ordered on one stream.
Prepared-input completion witnesses are synchronized before parking so cached graphs do not retain their input column owners indefinitely. The ordering proof relies on runtime-bound cuGraph handles using the cudf runtime stream directly, without a RAFT stream pool.
If this method returns an error, the consumed graph is dropped.
Sourcepub fn park_under(self, handle: &EnteredContext<'_>) -> Result<ParkedGraph<T>>where
T: Send,
pub fn park_under(self, handle: &EnteredContext<'_>) -> Result<ParkedGraph<T>>where
T: Send,
Park this graph under the ordered execution binding without requiring it to match the construction binding (storage/execution split).
The entering binding must be the ordered binding that executed all tracked
work, ensuring the recorded park event orders after preceding graph operations.
Teardown still runs under the retained creation leases. Use this after resume_under;
parking a graph that ran only under its construction binding must keep
using park.
If this method returns an error, the consumed graph is dropped.
Sourcepub fn properties(&self) -> GraphProperties
pub fn properties(&self) -> GraphProperties
Structural properties declared when this graph was constructed.
These are the graph-construction properties Rust passed to cuGraph
when creating this graph. They are reused by structural helpers such
as edge_count to interpret decompressed edge
lists with the same simple-vs-multigraph and directed-vs-undirected
semantics the graph was built with.
Sourcepub fn edge_count(&mut self, handle: &EnteredContext<'_>) -> Result<usize>
pub fn edge_count(&mut self, handle: &EnteredContext<'_>) -> Result<usize>
Return the number of edges currently stored in this graph.
Materializes a transient edgelist view via the cuGraph C API with O(|E|) cost.
The returned count follows the graph’s declared
GraphProperties:
- directed simple graphs count unique directed edges
- undirected simple graphs count unique unordered edge pairs
- directed multigraphs count all stored directed edge rows
- undirected multigraphs count unordered edge multiplicities, with self-loops counted once each
Sourcepub fn edge_count_checked(
&mut self,
handle: &EnteredContext<'_>,
do_expensive_check: bool,
) -> Result<usize>
pub fn edge_count_checked( &mut self, handle: &EnteredContext<'_>, do_expensive_check: bool, ) -> Result<usize>
Return the number of edges currently stored in this graph with optional expensive validation checks.
This has the same counting semantics as edge_count.
Sourcepub fn select_random_vertices<V: CugraphElement>(
&self,
handle: &EnteredContext<'_>,
rng_state: &mut RngState,
num_vertices: usize,
) -> Result<DeviceArray<V>>
pub fn select_random_vertices<V: CugraphElement>( &self, handle: &EnteredContext<'_>, rng_state: &mut RngState, num_vertices: usize, ) -> Result<DeviceArray<V>>
Select random vertices from this graph.
The returned DeviceArray owns the sampled vertex ids on the handle
device. The requested vertex dtype must match this graph’s vertex dtype.