Skip to main content

Graph

Struct Graph 

Source
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>

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn eigenvector_centrality( &mut self, handle: &EnteredContext<'_>, params: &EigenvectorCentralityParams, ) -> Result<CentralityResult>

Compute eigenvector centrality.

Source

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.

Source

pub fn hits( &mut self, handle: &EnteredContext<'_>, params: &HitsParams, ) -> Result<HitsResult>

Compute HITS hub and authority scores.

Source

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.

Source

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.

Source

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.

Source

pub fn degrees_all( &mut self, handle: &EnteredContext<'_>, ) -> Result<DegreesResult>

Compute degrees for every vertex in the graph.

Source

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.

Source

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.

Source

pub fn in_degrees_all( &mut self, handle: &EnteredContext<'_>, ) -> Result<InDegreesResult>

Compute in-degrees for every vertex in the graph.

Source§

impl Graph<Forward>

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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>

Sample homogeneous temporal neighborhoods uniformly from explicit start vertices.

Source

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>

Sample homogeneous temporal neighborhoods with biased sampling from explicit start vertices.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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>

Source

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.

Source

pub fn betweenness_centrality_all( &mut self, handle: &EnteredContext<'_>, params: &BetweennessCentralityParams, ) -> Result<BetweennessCentralityResult>

Compute exact betweenness centrality over all vertices.

Source

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.

Source

pub fn edge_betweenness_centrality_all( &mut self, handle: &EnteredContext<'_>, params: &EdgeBetweennessCentralityParams, ) -> Result<EdgeBetweennessCentralityResult>

Compute exact edge betweenness centrality over all vertices.

Source

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.

Source

pub fn strongly_connected_components( &mut self, handle: &EnteredContext<'_>, params: &ConnectedComponentsParams, ) -> Result<LabelingResult>

Compute strongly connected components.

Source

pub fn core_number( &mut self, handle: &EnteredContext<'_>, params: &CoreNumberParams, ) -> Result<CoreNumberResult>

Compute core numbers for all vertices.

Source

pub fn k_core( &mut self, handle: &EnteredContext<'_>, params: &KCoreParams, ) -> Result<KCoreResult>

Extract a k-core subgraph, computing core numbers internally.

Source

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.

Source

pub fn minimum_spanning_tree( &mut self, handle: &EnteredContext<'_>, params: &MinimumSpanningTreeParams, ) -> Result<MinimumSpanningTreeResult>

Compute a minimum spanning tree.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn out_degrees_all( &mut self, handle: &EnteredContext<'_>, ) -> Result<OutDegreesResult>

Compute out-degrees for every vertex in the graph.

Source

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.

Source

pub fn triangle_count_all( &mut self, handle: &EnteredContext<'_>, params: &TriangleCountParams, ) -> Result<TriangleCountResult>

Compute triangle counts for every vertex in the graph.

Source

pub fn k_truss_subgraph( &mut self, handle: &EnteredContext<'_>, params: &KTrussSubgraphParams, ) -> Result<KTrussSubgraphResult>

Extract a k-truss subgraph.

Source

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>

Source

pub fn vertex_dtype(&self) -> DataType

The data type of vertex IDs in this graph (Int32 or Int64).

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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
Source

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.

Source

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.

Trait Implementations§

Source§

impl<T> Debug for Graph<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T> Drop for Graph<T>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

§

impl<T = Forward> !Freeze for Graph<T>

§

impl<T = Forward> !RefUnwindSafe for Graph<T>

§

impl<T = Forward> !Send for Graph<T>

§

impl<T = Forward> !Sync for Graph<T>

§

impl<T = Forward> !UnwindSafe for Graph<T>

§

impl<T> Unpin for Graph<T>
where PhantomData<T>: Unpin,

§

impl<T> UnsafeUnpin for Graph<T>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.