erpc_analysis::db_client

Struct Neo4jAnalysisClient

source
pub struct Neo4jAnalysisClient { /* private fields */ }
Expand description

A client for interacting with Neo4j, tailored for eRPC analysis tasks.

Implementations§

source§

impl Neo4jAnalysisClient

source

pub async fn new(config: &Neo4jConfig) -> Result<Self, AnalysisError>

Creates a new Neo4jAnalysisClient instance.

Establishes a connection to the Neo4j database using the provided configuration.

§Arguments
  • config - A reference to Neo4jConfig containing the URI, username, and password.
§Errors

Returns AnalysisError::ConnectionFailed if the connection cannot be established.

Trait Implementations§

source§

impl AnalysisDatabase for Neo4jAnalysisClient

source§

fn create_graph_projection<'life0, 'life1, 'async_trait>( &'life0 self, params: &'life1 GraphProjectionParams, ) -> Pin<Box<dyn Future<Output = Result<(), AnalysisError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Creates or recreates a GDS graph projection in Neo4j.

This implementation first attempts to delete an existing projection with the same name to ensure idempotency, then creates a new one based on the provided parameters.

§Arguments
  • params - A reference to GraphProjectionParams specifying the projection name, node label, relationship types, and properties to project.
§Errors

Returns AnalysisError if any step (deletion of old projection, creation of new projection) fails. This includes driver errors, query failures, or issues with GDS procedures

source§

fn delete_graph_projection<'life0, 'life1, 'async_trait>( &'life0 self, projection_name: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), AnalysisError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Deletes an existing GDS graph projection from Neo4j if it exists.

This method first checks if the projection exists using gds.graph.exists (via check_graph_projection_exists). If it does, gds.graph.drop is called.

The operation is idempotent and will succeed even if the projection does not initially exist.

§Arguments
  • projection_name - The name of the GDS graph projection to delete.
§Errors

Returns AnalysisError if checking for existence or executing the drop query fails

source§

fn check_graph_projection_exists<'life0, 'life1, 'async_trait>( &'life0 self, projection_name: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<bool, AnalysisError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Checks if a GDS graph projection with the given name exists in Neo4j.

This method calls the gds.graph.exists procedure.

§Arguments
  • projection_name - The name of the GDS graph projection to check.
§Returns

Ok(true) if the projection exists, Ok(false) otherwise.

§Errors

Returns AnalysisError if the query to gds.graph.exists fails or the result cannot be parsed correctly.

source§

fn calculate_graph_metrics<'life0, 'life1, 'async_trait>( &'life0 self, projection_name: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<GraphMetrics, AnalysisError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Calculates comprehensive graph metrics for a given GDS projection including basic counts (node count, relationship count), degree distribution, and degree statistics.

source§

fn calculate_node_degrees<'life0, 'life1, 'async_trait>( &'life0 self, projection_name: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<NodeMetrics>, AnalysisError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Calculates node-level degree metrics for all nodes in a given GDS projection. Uses both Neo4j GDS library for total degree and direct Cypher for in/out degree calculation.

source§

fn calculate_weakly_connected_components<'life0, 'life1, 'async_trait>( &'life0 self, projection_name: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<ComponentAnalysisResult, AnalysisError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Calculates weakly connected components using Neo4j GDS WCC algorithm. Returns analysis results containing components, sizes, and statistics.

source§

fn calculate_strongly_connected_components<'life0, 'life1, 'async_trait>( &'life0 self, projection_name: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<ComponentAnalysisResult, AnalysisError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Calculates strongly connected components using Neo4j GDS SCC algorithm. Returns analysis results containing components, sizes, and statistics.

source§

fn calculate_louvain_communities<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, projection_name: &'life1 str, params: &'life2 LouvainConfig, ) -> Pin<Box<dyn Future<Output = Result<ComponentAnalysisResult, AnalysisError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Calculates communities using Neo4j GDS Louvain algorithm. Returns analysis results containing communities, sizes, and statistics.

source§

fn calculate_label_propagation_communities<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, projection_name: &'life1 str, params: &'life2 LabelPropagationConfig, ) -> Pin<Box<dyn Future<Output = Result<ComponentAnalysisResult, AnalysisError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Calculates communities using Neo4j GDS Label Propagation algorithm. Returns analysis results containing communities, sizes, and statistics.

source§

fn calculate_modularity<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, projection_name: &'life1 str, community_property: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<f64, AnalysisError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Calculates modularity score for a given community assignment. Higher modularity indicates better community structure.

source§

fn classify_components_by_geography<'life0, 'life1, 'async_trait>( &'life0 self, components: &'life1 [ConnectedComponent], ) -> Pin<Box<dyn Future<Output = Result<PartitionClassificationResult, AnalysisError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Classifies connected components by geographic location (country)

source§

fn classify_components_by_asn<'life0, 'life1, 'async_trait>( &'life0 self, components: &'life1 [ConnectedComponent], ) -> Pin<Box<dyn Future<Output = Result<PartitionClassificationResult, AnalysisError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Classifies connected components by ASN

source§

fn classify_components_by_family<'life0, 'life1, 'async_trait>( &'life0 self, components: &'life1 [ConnectedComponent], ) -> Pin<Box<dyn Future<Output = Result<PartitionClassificationResult, AnalysisError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Classifies connected components by relay family relationships

source§

fn calculate_combined_centrality<'life0, 'life1, 'async_trait>( &'life0 self, projection_name: &'life1 str, betweenness_sampling_size: Option<usize>, betweenness_sampling_seed: Option<u64>, use_wasserman_faust: Option<bool>, ) -> Pin<Box<dyn Future<Output = Result<CentralityAnalysisResult, AnalysisError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Calculates both betweenness and closeness centrality.

source§

fn analyze_paths_between_communities<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, projection_name: &'life1 str, source_nodes: &'life2 [String], target_nodes: &'life3 [String], ) -> Pin<Box<dyn Future<Output = Result<PathAnalysisResult, AnalysisError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Analyzes shortest paths between nodes from different communities.

source§

fn calculate_betweenness_centrality<'life0, 'life1, 'async_trait>( &'life0 self, projection_name: &'life1 str, sampling_size: Option<usize>, sampling_seed: Option<u64>, ) -> Pin<Box<dyn Future<Output = Result<CentralityAnalysisResult, AnalysisError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Calculates betweenness centrality for nodes in a GDS projection. Uses Neo4j GDS betweenness centrality algorithm to identify nodes that act as bridges between other nodes.
source§

fn calculate_closeness_centrality<'life0, 'life1, 'async_trait>( &'life0 self, projection_name: &'life1 str, use_wasserman_faust: Option<bool>, ) -> Pin<Box<dyn Future<Output = Result<CentralityAnalysisResult, AnalysisError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Calculates closeness centrality for nodes in a GDS projection. Uses Neo4j GDS closeness centrality algorithm to identify nodes that are close to all other nodes in the network.

Auto Trait Implementations§

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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V