From 71137ab4d681f4fe45b43b4462c961eaaf02ed82 Mon Sep 17 00:00:00 2001 From: Dhruv-K-Jain <138356622+Dhruv-K-Jain@users.noreply.github.com> Date: Thu, 26 Nov 2026 10:35:20 +0530 Subject: [PATCH] feat(gds): support Personalized Page Rank in query engines native execution path --- src/query/gds_procedure.rs | 92 +++++++++++- src/shard/gds_procedure.rs | 145 ++++++++++++++++-- src/sparse_kernel/lagraph.rs | 277 ++++++++++++++++++++++++++++++++++- src/sparse_kernel/mod.rs | 2 +- 4 files changed, 493 insertions(+), 23 deletions(-) diff --git a/src/query/gds_procedure.rs b/src/query/gds_procedure.rs index 607aa2e8..eeaf1773 100644 --- a/src/query/gds_procedure.rs +++ b/src/query/gds_procedure.rs @@ -11,10 +11,10 @@ //! every option that would change the answer and is not implemented is //! refused by name rather than ignored. -use std::collections::BTreeMap; +use std::collections::{BTreeMap, BTreeSet}; use super::path_procedure::{lex, Token}; -use crate::{GraphError, QueryColumn, QueryFailureReason, Result, VertexPropertyValue}; +use crate::{GraphError, QueryColumn, QueryFailureReason, Result, VertexId, VertexPropertyValue}; /// The GDS release whose procedure signatures this surface answers. The /// client compares it with the oldest server version it supports. @@ -284,6 +284,10 @@ pub(crate) struct GdsPageRankConfig { pub(crate) tolerance: f64, /// The `.write` mode's `writeProperty`; `None` is `.stream`. pub(crate) write_property: Option, + /// `sourceNodes`: the vertices the teleport mass is spread over, in the + /// order given. `None` spreads it over every vertex, which is the + /// unpersonalized algorithm. + pub(crate) source_nodes: Option>, } #[derive(Clone, Debug, Eq, PartialEq)] @@ -717,6 +721,7 @@ fn page_rank_config(name: &str, config: Option<&GdsValue>) -> Result configuration(name, config)?.iter().collect(), @@ -748,11 +753,7 @@ fn page_rank_config(name: &str, config: Option<&GdsValue>) -> Result {} "scaler" => return unsupported(format!("{name} scaler is not supported; scores are returned unscaled")), "sourceNodes" if *value == GdsValue::Null => {} - "sourceNodes" => { - return unsupported(format!( - "{name} sourceNodes is not supported; personalised PageRank is not implemented" - )) - } + "sourceNodes" => result.source_nodes = Some(source_nodes(name, value)?), key => algorithm_option(name, key, value)?, } } @@ -760,6 +761,29 @@ fn page_rank_config(name: &str, config: Option<&GdsValue>) -> Result Result> { + let GdsValue::List(values) = value else { + return unsupported(format!("{name} sourceNodes must be a list of node ids, not {}", value.kind())); + }; + if values.is_empty() { + return unsupported(format!("{name} sourceNodes must not be empty")); + } + let mut nodes = Vec::with_capacity(values.len()); + let mut seen = BTreeSet::new(); + for value in values { + let GdsValue::Integer(id) = value else { + return unsupported(format!("{name} sourceNodes must hold node ids, not {}", value.kind())); + }; + let id = u64::try_from(*id) + .map_err(|_| procedure_error(format!("{name} sourceNodes node id {id} is negative; node ids are unsigned")))?; + if !seen.insert(id) { + return unsupported(format!("{name} sourceNodes lists node id {id} more than once")); + } + nodes.push(id); + } + Ok(nodes) +} + fn betweenness_config(name: &str, config: Option<&GdsValue>) -> Result { let mut result = GdsBetweennessConfig { sampling_size: None, @@ -1136,6 +1160,9 @@ impl GdsProcedure { ("dampingFactor".to_string(), float(config.damping_factor)), ("tolerance".to_string(), float(config.tolerance)), ]; + if let Some(nodes) = &config.source_nodes { + entries.push(("sourceNodes".to_string(), list(nodes.iter().map(|node| node.to_string())))); + } if let Some(property) = &config.write_property { entries.push(("writeProperty".to_string(), quote_string(property))); } @@ -1212,3 +1239,54 @@ fn map(entries: impl IntoIterator) -> String { .collect::>(); format!("{{{}}}", entries.join(", ")) } + +#[cfg(test)] +mod tests { + use super::*; + + fn parse(query: &str) -> GdsProcedure { + parse_gds_procedure(query, &BTreeMap::new()).unwrap_or_else(|error| panic!("{query} was refused: {error}")) + } + + fn page_rank(query: &str) -> GdsPageRankConfig { + match parse(query).call { + GdsCall::PageRank { config, .. } => config, + call => panic!("{query} parsed as {call:?}"), + } + } + + #[test] + fn source_nodes_parse_in_stream_and_write() { + let config = page_rank("CALL gds.pageRank.stream('g', {sourceNodes: [4, 2]}) YIELD nodeId, score"); + assert_eq!(config.source_nodes, Some(vec![4, 2])); + assert_eq!(config.write_property, None); + let config = page_rank("CALL gds.pageRank.write('g', {sourceNodes: [4], writeProperty: 'ppr'})"); + assert_eq!(config.source_nodes, Some(vec![4])); + assert_eq!(config.write_property.as_deref(), Some("ppr")); + } + + #[test] + fn a_null_source_nodes_is_the_unpersonalized_algorithm() { + let config = page_rank("CALL gds.pageRank.stream('g', {sourceNodes: null}) YIELD nodeId, score"); + assert_eq!(config.source_nodes, None); + } + + #[test] + fn source_nodes_round_trip_through_the_printed_call() { + let procedure = parse("CALL gds.pageRank.stream('g', {sourceNodes: [4, 2], dampingFactor: 0.5}) YIELD nodeId, score"); + assert_eq!(parse(&procedure.to_cypher()), procedure); + } + + #[test] + fn source_nodes_are_refused_when_empty_duplicated_or_not_ids() { + for query in [ + "CALL gds.pageRank.stream('g', {sourceNodes: []}) YIELD nodeId, score", + "CALL gds.pageRank.stream('g', {sourceNodes: [1, 1]}) YIELD nodeId, score", + "CALL gds.pageRank.stream('g', {sourceNodes: [1, -1]}) YIELD nodeId, score", + "CALL gds.pageRank.stream('g', {sourceNodes: [1.5]}) YIELD nodeId, score", + "CALL gds.pageRank.stream('g', {sourceNodes: 'n'}) YIELD nodeId, score", + ] { + assert!(parse_gds_procedure(query, &BTreeMap::new()).is_err(), "{query} was accepted"); + } + } +} diff --git a/src/shard/gds_procedure.rs b/src/shard/gds_procedure.rs index ca66366c..22cbf700 100644 --- a/src/shard/gds_procedure.rs +++ b/src/shard/gds_procedure.rs @@ -634,16 +634,34 @@ impl GraphShard { let config = config.clone(); let graph = Arc::clone(&graph); run_graph_compute(Arc::clone(&self.operation_metrics), "gds_page_rank", move || { - // One library call: the iteration limit bounds it, not - // the deadline, which is checked only before it starts. compute_budget.check("gds_page_rank")?; - let Some((scores, iterations)) = crate::sparse_kernel::pagerank( - &graph.edges, - config.damping_factor as f32, - config.tolerance as f32, - config.max_iterations, - )? - else { + let sources = config + .source_nodes + .as_deref() + .map(|nodes| source_ordinals(&graph, nodes, &graph_name)) + .transpose()?; + let result = match sources { + // One library call: the iteration limit bounds it, not + // the deadline, which is checked only before it starts. + None => crate::sparse_kernel::pagerank( + &graph.edges, + config.damping_factor as f32, + config.tolerance as f32, + config.max_iterations, + ), + // The power iteration checks the deadline between + // iterations, so a large personalized run stops when + // the query is cancelled or times out. + Some(sources) => crate::sparse_kernel::personalized_pagerank( + &graph.edges, + &sources, + config.damping_factor as f32, + config.tolerance as f32, + config.max_iterations, + || compute_budget.check("gds_page_rank"), + ), + }; + let Some((scores, iterations)) = result? else { // GDS would return these scores with didConverge // false; LAGraph frees them, so there is nothing to // return but the reason. @@ -718,11 +736,19 @@ impl GraphShard { ("deletedPairsDropped", QueryValue::Count(deleted_pairs)), ]; match &procedure.call { - GdsCall::PageRank { config, .. } => configuration.extend([ - ("maxIterations", QueryValue::Count(u64::from(config.max_iterations))), - ("dampingFactor", QueryValue::Float(QueryFloat(config.damping_factor))), - ("tolerance", QueryValue::Float(QueryFloat(config.tolerance))), - ]), + GdsCall::PageRank { config, .. } => { + configuration.extend([ + ("maxIterations", QueryValue::Count(u64::from(config.max_iterations))), + ("dampingFactor", QueryValue::Float(QueryFloat(config.damping_factor))), + ("tolerance", QueryValue::Float(QueryFloat(config.tolerance))), + ]); + if let Some(nodes) = &config.source_nodes { + configuration.push(( + "sourceNodes", + QueryValue::List(nodes.iter().copied().map(QueryValue::VertexId).collect()), + )); + } + } _ => configuration.extend([ ("samplingSize", QueryValue::Count(sampling.0)), ( @@ -1087,6 +1113,56 @@ impl GraphShard { } } +/// Returns the position of each `sourceNodes` id within `graph.vertices`, in +/// the same order. The kernel addresses vertices by position, not by id. +/// +/// Label projections keep `vertices` sorted, so each id is a binary search. +/// `'*'` keeps them in first-encounter order, so one pass finds them all, +/// using a map of only the requested ids. A missing id is an error. +fn source_ordinals(graph: &GdsProjectedGraph, nodes: &[VertexId], graph_name: &str) -> Result> { + let unknown = |node: VertexId| { + gds_refusal(format!( + "sourceNodes node {node} is not a vertex of graph '{graph_name}'; project the node or drop it from sourceNodes" + )) + }; + let ascending = graph.vertices.is_sorted(); + if ascending { + return nodes + .iter() + .map(|node| { + graph + .vertices + .binary_search(node) + .map(|ordinal| ordinal as u64) + .map_err(|_| unknown(*node)) + }) + .collect(); + } + let mut wanted = HashMap::with_capacity(nodes.len()); + for (position, node) in nodes.iter().enumerate() { + wanted.entry(*node).or_insert(position); + } + let mut ordinals = vec![u64::MAX; nodes.len()]; + let mut missing = nodes.len(); + for (ordinal, vertex) in graph.vertices.iter().enumerate() { + let Some(&position) = wanted.get(vertex) else { + continue; + }; + if ordinals[position] == u64::MAX { + ordinals[position] = ordinal as u64; + missing -= 1; + if missing == 0 { + break; + } + } + } + if missing > 0 { + let position = ordinals.iter().position(|ordinal| *ordinal == u64::MAX).unwrap_or_default(); + return Err(unknown(nodes[position])); + } + Ok(ordinals) +} + /// The edge walk of [`GraphShard::gds_projected_graph`]. With labels, /// `members` are the vertices, in ascending id order, isolated ones /// included, and an edge is kept only when both ends are members. With @@ -1420,3 +1496,44 @@ fn dense_sample_is_smaller(vertices: u64, size: u64) -> bool { }; vertices.saturating_mul(8) <= buckets.saturating_mul(17).saturating_add(size.saturating_mul(8)) } + +#[cfg(test)] +mod tests { + use super::*; + + fn projected_graph(vertices: Vec) -> GdsProjectedGraph { + let mut edges = OrdinalEdges::new(vertices.len() as u64); + if vertices.len() >= 2 { + edges.push(0, 1); + } + GdsProjectedGraph { + vertices, + edges, + deleted_pairs_dropped: 0, + distinct_pairs: std::sync::OnceLock::new(), + } + } + + #[test] + fn a_sorted_projection_resolves_by_binary_search() { + let graph = projected_graph(vec![2, 4, 8]); + assert_eq!(source_ordinals(&graph, &[8, 2], "g").unwrap(), vec![2, 0]); + assert_eq!(source_ordinals(&graph, &[4], "g").unwrap(), vec![1]); + } + + #[test] + fn an_unsorted_projection_resolves_by_map() { + let graph = projected_graph(vec![8, 2, 4]); + assert_eq!(source_ordinals(&graph, &[2, 4], "g").unwrap(), vec![1, 2]); + assert_eq!(source_ordinals(&graph, &[8], "g").unwrap(), vec![0]); + } + + #[test] + fn a_node_outside_the_projection_is_refused() { + for vertices in [vec![2, 4, 8], vec![8, 2, 4]] { + let graph = projected_graph(vertices); + let error = source_ordinals(&graph, &[3], "g").unwrap_err(); + assert!(error.to_string().contains("sourceNodes node 3"), "{error}"); + } + } +} diff --git a/src/sparse_kernel/lagraph.rs b/src/sparse_kernel/lagraph.rs index a2a8c2ca..b6cf911f 100644 --- a/src/sparse_kernel/lagraph.rs +++ b/src/sparse_kernel/lagraph.rs @@ -6,7 +6,9 @@ //! from one index generation, so a cache would have to be keyed on it. //! //! PageRank is one `LAGr_PageRank` call, which handles sinks so scores sum to -//! 1, and which has no result to give when `itermax` passes unconverged. +//! 1, and which has no result to give when `itermax` passes unconverged. That +//! call has no teleport vector, so a personalized run repeats the same +//! iteration in Rust over the ordinal pairs; see [`personalized_pagerank`]. //! Betweenness is `LAGr_Betweenness`, one batch of sources at a time. use std::ffi::{c_char, c_void, CStr}; @@ -190,6 +192,143 @@ pub(crate) fn pagerank(edges: &OrdinalEdges, damping: f32, tolerance: f32, max_i Ok(Some((dense_fp32(¢rality, n)?, u32::try_from(iterations).unwrap_or(0)))) } +/// Personalized PageRank: [`pagerank`]'s iteration with the teleport mass +/// spread over `source_ordinals` instead of every vertex. With every vertex as +/// a source it converges to the same scores at the same damping and tolerance. +/// +/// Sources must be distinct and below `edges.vertices`. `None` when +/// `max_iterations` pass first; `check_budget` runs before every iteration and +/// at every multiple of 4096 rows of the adjacency build. +pub(crate) fn personalized_pagerank( + edges: &OrdinalEdges, + source_ordinals: &[u64], + damping: f32, + tolerance: f32, + max_iterations: u32, + mut check_budget: impl FnMut() -> Result<()>, +) -> Result, u32)>> { + if source_ordinals.is_empty() { + return Err(GraphError::SparseKernel { + backend: "power-iteration", + reason: "personalized pagerank needs at least one source node".to_string(), + }); + } + let n = usize::try_from(edges.vertices).unwrap_or(usize::MAX); + if let Some(source) = source_ordinals.iter().find(|source| **source >= edges.vertices) { + return Err(GraphError::SparseKernel { + backend: "power-iteration", + reason: format!("personalized pagerank source ordinal {source} is outside the {n}-vertex graph"), + }); + } + if n == 0 { + return Ok(Some((Vec::new(), 0))); + } + let (offsets, targets) = deduplicated_adjacency(edges, &mut check_budget)?; + let source_share = 1.0_f32 / source_ordinals.len() as f32; + let mut teleport = vec![0.0_f32; n]; + for &source in source_ordinals { + teleport[source as usize] = source_share; + } + // `LAGr_PageRank` starts from the uniform distribution rather than from + // the teleport vector; the fixed point is the same from either. + let mut rank = vec![1.0_f32 / n as f32; n]; + let mut next = vec![0.0_f32; n]; + for iteration in 1..=max_iterations { + check_budget()?; + let sink_mass = rank + .iter() + .enumerate() + .filter(|(vertex, _)| offsets[*vertex] == offsets[*vertex + 1]) + .map(|(_, score)| *score) + .sum::(); + let base = (1.0 - damping) + damping * sink_mass; + for (value, teleport) in next.iter_mut().zip(&teleport) { + *value = base * teleport; + } + for source in 0..n { + let start = offsets[source]; + let end = offsets[source + 1]; + if start == end { + continue; + } + let flow = damping * rank[source] / (end - start) as f32; + for &target in &targets[start..end] { + next[target as usize] += flow; + } + } + // Rounding drifts the total every iteration; the kernels promise a + // distribution, so restore it before comparing. + let total = next.iter().sum::(); + if total > 0.0 { + let inverse = 1.0 / total; + for value in &mut next { + *value *= inverse; + } + } + let delta = next.iter().zip(&rank).map(|(next, rank)| (next - rank).abs()).sum::(); + std::mem::swap(&mut rank, &mut next); + if delta <= tolerance { + return Ok(Some((rank, iteration))); + } + } + Ok(None) +} + +/// The pairs as a CSR adjacency: `offsets[vertex]..offsets[vertex + 1]` holds +/// that vertex's distinct targets, ascending. Parallel pairs collapse to one +/// edge, since counting one twice would change an out-degree and every score. +/// +/// `check_budget` runs at each row index that is a multiple of 4096 (row 0 +/// included), so a large build is interruptible like the iteration itself. +fn deduplicated_adjacency(edges: &OrdinalEdges, check_budget: &mut impl FnMut() -> Result<()>) -> Result<(Vec, Vec)> { + let n = usize::try_from(edges.vertices).unwrap_or(usize::MAX); + let mut offsets = vec![0_usize; n + 1]; + for &source in &edges.sources { + offsets[source as usize + 1] += 1; + } + for vertex in 1..=n { + offsets[vertex] += offsets[vertex - 1]; + } + let mut targets = vec![0_u64; edges.len()]; + let mut cursor = offsets.clone(); + for (&source, &target) in edges.sources.iter().zip(&edges.targets) { + let slot = &mut cursor[source as usize]; + targets[*slot] = target; + *slot += 1; + } + drop(cursor); + // Rows are visited in vertex order and a row never grows, so each + // deduplicated row can be copied into the space the earlier rows left. + let mut deduplicated = Vec::with_capacity(n + 1); + deduplicated.push(0); + let mut written = 0_usize; + for source in 0..n { + if source.is_multiple_of(4_096) { + check_budget()?; + } + let start = offsets[source]; + let end = offsets[source + 1]; + let row = &mut targets[start..end]; + row.sort_unstable(); + let mut length = 0; + let mut index = 0; + while index < row.len() { + let value = row[index]; + row[length] = value; + length += 1; + index += 1; + while index < row.len() && row[index] == value { + index += 1; + } + } + targets.copy_within(start..start + length, written); + written += length; + deduplicated.push(written); + } + targets.truncate(written); + Ok((deduplicated, targets)) +} + /// Betweenness centrality summed over `sources`, counting each ordered /// source/target pair. Every vertex as a source gives the exact score; a /// subset gives the sampled estimate. @@ -457,3 +596,139 @@ fn message(msg: &[c_char; LAGRAPH_MSG_LEN]) -> String { terminated[LAGRAPH_MSG_LEN - 1] = 0; unsafe { CStr::from_ptr(terminated.as_ptr()) }.to_string_lossy().into_owned() } + +#[cfg(test)] +mod tests { + use super::*; + + fn edges(vertices: u64, pairs: &[(u64, u64)]) -> OrdinalEdges { + let mut edges = OrdinalEdges::new(vertices); + for &(source, target) in pairs { + edges.push(source, target); + } + edges + } + + fn personalized(edges: &OrdinalEdges, sources: &[u64]) -> Vec { + personalized_pagerank(edges, sources, 0.85, 1e-5, 500, || Ok(())) + .expect("the power iteration failed") + .expect("the power iteration did not converge") + .0 + } + + fn assert_close(left: &[f32], right: &[f32], tolerance: f32) { + assert_eq!(left.len(), right.len()); + for (index, (left, right)) in left.iter().zip(right).enumerate() { + assert!((left - right).abs() <= tolerance, "score {index} differs: {left} against {right}"); + } + } + + fn assert_distribution(scores: &[f32]) { + let total: f32 = scores.iter().sum(); + assert!((total - 1.0).abs() <= 1e-5, "scores sum to {total}, not 1"); + } + + /// The free equivalence test: every vertex a source is the unpersonalized + /// algorithm, so the two kernels must agree on the same topology. + #[test] + fn a_uniform_source_nodes_list_matches_lagraph_pagerank() { + let graphs = [ + edges(4, &[(0, 1), (1, 2), (2, 3), (3, 0)]), + // A sink: 3 has no outgoing edge. + edges(4, &[(0, 1), (1, 2), (2, 3)]), + // Two disconnected components. + edges(4, &[(0, 1), (2, 3)]), + // A parallel pair that the matrix build collapses to one edge. + edges(3, &[(0, 1), (0, 1), (1, 2), (2, 0)]), + // A self-loop. + edges(3, &[(0, 0), (0, 1), (1, 2)]), + ]; + for edges in graphs { + let uniform = (0..edges.vertices).collect::>(); + // Both runs stop once their own L1 change is below the tolerance, + // so the tighter the tolerance the smaller the gap the comparison + // has to absorb. + let expected = pagerank(&edges, 0.85, 1e-6, 500) + .expect("LAGraph failed") + .expect("LAGraph did not converge") + .0; + let personalized = personalized_pagerank(&edges, &uniform, 0.85, 1e-6, 500, || Ok(())) + .expect("the power iteration failed") + .expect("the power iteration did not converge") + .0; + assert_close(&personalized, &expected, 1e-4); + } + } + + #[test] + fn a_personalized_run_keeps_its_mass_near_the_source() { + let edges = edges(5, &[(0, 1), (1, 2), (2, 3), (3, 4)]); + let scores = personalized(&edges, &[0]); + assert_distribution(&scores); + assert!(scores[0] > scores[1], "source {scores:?}"); + assert!(scores[1] > scores[2], "hop 1 {scores:?}"); + assert!(scores[2] > scores[3], "hop 2 {scores:?}"); + assert!(scores[3] > scores[4], "hop 3 {scores:?}"); + } + + #[test] + fn a_sink_that_is_reachable_keeps_a_score() { + let edges = edges(3, &[(0, 1), (1, 2)]); + let scores = personalized(&edges, &[0]); + assert_distribution(&scores); + assert!(scores[2] > 0.0, "the sink's score is {scores:?}"); + } + + #[test] + fn several_sources_split_the_teleport_mass() { + // No edges at all: every vertex is a sink, so the whole distribution + // is the teleport vector. + let scores = personalized(&edges(4, &[]), &[0, 2]); + assert_close(&scores, &[0.5, 0.0, 0.5, 0.0], 1e-6); + assert_distribution(&scores); + } + + #[test] + fn duplicate_pairs_count_once() { + let duplicated = edges(3, &[(0, 1), (0, 1), (1, 2), (2, 0)]); + let distinct = edges(3, &[(0, 1), (1, 2), (2, 0)]); + assert_eq!(personalized(&duplicated, &[0]), personalized(&distinct, &[0])); + } + + #[test] + fn every_vertex_a_source_equals_the_uniform_teleport_vector() { + let edges = edges(3, &[(0, 1), (1, 2), (2, 0)]); + let scores = personalized(&edges, &[0, 1, 2]); + assert_distribution(&scores); + // Uniform teleport over a symmetric cycle is the uniform distribution. + assert_close(&scores, &[1.0 / 3.0; 3], 1e-5); + } + + #[test] + fn the_budget_is_checked_before_the_first_iteration() { + let edges = edges(3, &[(0, 1), (1, 2)]); + let mut calls = 0; + let result = personalized_pagerank(&edges, &[0], 0.85, 1e-5, 500, || { + calls += 1; + Err(GraphError::SparseKernel { + backend: "test", + reason: "cancelled".to_string(), + }) + }); + assert!(result.is_err()); + assert_eq!(calls, 1, "the build checked the budget before iterating"); + } + + #[test] + fn a_run_that_does_not_converge_returns_none() { + let edges = edges(3, &[(0, 1), (1, 2)]); + assert_eq!(personalized_pagerank(&edges, &[0], 0.85, 0.0, 1, || Ok(())).unwrap(), None); + } + + #[test] + fn invalid_sources_are_refused() { + let edges = edges(3, &[(0, 1)]); + assert!(personalized_pagerank(&edges, &[], 0.85, 1e-5, 10, || Ok(())).is_err()); + assert!(personalized_pagerank(&edges, &[3], 0.85, 1e-5, 10, || Ok(())).is_err()); + } +} diff --git a/src/sparse_kernel/mod.rs b/src/sparse_kernel/mod.rs index 86bebfe0..21a236e0 100644 --- a/src/sparse_kernel/mod.rs +++ b/src/sparse_kernel/mod.rs @@ -421,4 +421,4 @@ mod graphblas; mod lagraph; #[cfg(feature = "opencypher")] -pub(crate) use lagraph::{betweenness, betweenness_batch, pagerank, OrdinalEdges}; +pub(crate) use lagraph::{betweenness, betweenness_batch, pagerank, personalized_pagerank, OrdinalEdges};