pub struct BetweennessCentralityConfig {
pub normalize: bool,
pub direction: Direction,
pub include_endpoints: bool,
pub max_graph_nodes: Option<usize>,
}Expand description
Configuration for Betweenness Centrality computation.
Fields§
§normalize: boolWhether to normalize centrality values to [0, 1]. Default: true
direction: DirectionDirection of edges to follow. Default: Both (treat as undirected)
include_endpoints: boolWhether to include endpoints in the centrality calculation. Default: false
max_graph_nodes: Option<usize>Maximum number of nodes allowed before returning an error.
Set to None to disable the check.
Default: 10,000,000 (10M nodes)
Implementations§
Source§impl BetweennessCentralityConfig
impl BetweennessCentralityConfig
Sourcepub const fn with_normalize(self, normalize: bool) -> Self
pub const fn with_normalize(self, normalize: bool) -> Self
Set whether to normalize centrality values.
When normalized, values are scaled to [0, 1] by dividing by (n-1)(n-2)/2 for undirected or (n-1)(n-2) for directed graphs.
Sourcepub const fn with_direction(self, direction: Direction) -> Self
pub const fn with_direction(self, direction: Direction) -> Self
Set the direction to follow edges.
Outgoing: Follow edges in their natural directionIncoming: Follow edges in reverseBoth: Treat graph as undirected (default)
Sourcepub const fn with_include_endpoints(self, include: bool) -> Self
pub const fn with_include_endpoints(self, include: bool) -> Self
Set whether to include endpoints in centrality calculation.
When true, source and target nodes also contribute to the centrality of intermediate nodes.
Sourcepub const fn with_max_graph_nodes(self, limit: Option<usize>) -> Self
pub const fn with_max_graph_nodes(self, limit: Option<usize>) -> Self
Set the maximum number of nodes allowed.
If the graph has more nodes than this limit, the algorithm will
return a GraphError::GraphTooLarge error instead of attempting
to allocate potentially gigabytes of memory.
Set to None to disable the check (use with caution).
Trait Implementations§
Source§impl Clone for BetweennessCentralityConfig
impl Clone for BetweennessCentralityConfig
Source§fn clone(&self) -> BetweennessCentralityConfig
fn clone(&self) -> BetweennessCentralityConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more