pub struct GeometricNetwork<const P: usize, const Q: usize, const R: usize> { /* private fields */ }Expand description
A network where nodes are embedded in geometric algebra space
Each node is represented as a multivector in Cl(P,Q,R), enabling geometric operations like distance computation and geometric products for information diffusion.
Implementations§
Source§impl<const P: usize, const Q: usize, const R: usize> GeometricNetwork<P, Q, R>
impl<const P: usize, const Q: usize, const R: usize> GeometricNetwork<P, Q, R>
Sourcepub fn with_capacity(num_nodes: usize, num_edges: usize) -> Self
pub fn with_capacity(num_nodes: usize, num_edges: usize) -> Self
Create a network with pre-allocated capacity
Sourcepub fn add_node(&mut self, position: Multivector<P, Q, R>) -> usize
pub fn add_node(&mut self, position: Multivector<P, Q, R>) -> usize
Add a node at the specified geometric position
Returns the index of the newly added node.
Sourcepub fn add_node_with_metadata(
&mut self,
position: Multivector<P, Q, R>,
metadata: NodeMetadata,
) -> usize
pub fn add_node_with_metadata( &mut self, position: Multivector<P, Q, R>, metadata: NodeMetadata, ) -> usize
Add a node with associated metadata
Returns the index of the newly added node.
Sourcepub fn add_edge(
&mut self,
source: usize,
target: usize,
weight: f64,
) -> NetworkResult<()>
pub fn add_edge( &mut self, source: usize, target: usize, weight: f64, ) -> NetworkResult<()>
Add a directed edge between two nodes
Sourcepub fn add_undirected_edge(
&mut self,
a: usize,
b: usize,
weight: f64,
) -> NetworkResult<()>
pub fn add_undirected_edge( &mut self, a: usize, b: usize, weight: f64, ) -> NetworkResult<()>
Add an undirected edge (creates two directed edges)
Sourcepub fn get_node(&self, index: usize) -> Option<&Multivector<P, Q, R>>
pub fn get_node(&self, index: usize) -> Option<&Multivector<P, Q, R>>
Get a reference to a node’s position
Sourcepub fn get_metadata(&self, index: usize) -> Option<&NodeMetadata>
pub fn get_metadata(&self, index: usize) -> Option<&NodeMetadata>
Get metadata for a node
Sourcepub fn edges(&self) -> &[GeometricEdge]
pub fn edges(&self) -> &[GeometricEdge]
Get all edges in the network
Sourcepub fn geometric_distance(
&self,
node1: usize,
node2: usize,
) -> NetworkResult<f64>
pub fn geometric_distance( &self, node1: usize, node2: usize, ) -> NetworkResult<f64>
Compute geometric distance between two nodes
Uses the natural norm in Clifford algebra space: ||a - b|| where a and b are the multivector positions of the nodes.
Sourcepub fn compute_geometric_centrality(&self) -> NetworkResult<Vec<f64>>
pub fn compute_geometric_centrality(&self) -> NetworkResult<Vec<f64>>
Compute geometric centrality for all nodes
Geometric centrality is based on the inverse of the sum of geometric distances to all other nodes. Nodes closer to the geometric center of the network have higher centrality.
Sourcepub fn compute_betweenness_centrality(&self) -> NetworkResult<Vec<f64>>
pub fn compute_betweenness_centrality(&self) -> NetworkResult<Vec<f64>>
Compute betweenness centrality for all nodes
Measures how often each node lies on shortest paths between other pairs of nodes using graph-theoretic shortest paths.
Sourcepub fn compute_all_pairs_shortest_paths(&self) -> NetworkResult<Vec<Vec<f64>>>
pub fn compute_all_pairs_shortest_paths(&self) -> NetworkResult<Vec<Vec<f64>>>
Compute all-pairs shortest paths using Floyd-Warshall algorithm
Returns a matrix where element [i][j] is the shortest path distance from node i to node j using edge weights.
Sourcepub fn shortest_path(
&self,
source: usize,
target: usize,
) -> NetworkResult<Option<(Vec<usize>, f64)>>
pub fn shortest_path( &self, source: usize, target: usize, ) -> NetworkResult<Option<(Vec<usize>, f64)>>
Find shortest path between two nodes using Dijkstra’s algorithm
Returns the path as a vector of node indices and the total distance. Uses edge weights for distance computation.
Sourcepub fn shortest_geometric_path(
&self,
source: usize,
target: usize,
) -> NetworkResult<Option<(Vec<usize>, f64)>>
pub fn shortest_geometric_path( &self, source: usize, target: usize, ) -> NetworkResult<Option<(Vec<usize>, f64)>>
Find shortest path using geometric distances
Uses geometric distances between multivector positions rather than edge weights. This provides a direct path in the geometric algebra space.
Sourcepub fn to_tropical_network(&self) -> NetworkResult<TropicalNetwork>
pub fn to_tropical_network(&self) -> NetworkResult<TropicalNetwork>
Convert to tropical network for efficient path operations
Creates a TropicalNetwork representation using edge weights, enabling fast shortest path computations via tropical algebra.
Sourcepub fn find_communities(
&self,
num_communities: usize,
) -> NetworkResult<Vec<Community<P, Q, R>>>
pub fn find_communities( &self, num_communities: usize, ) -> NetworkResult<Vec<Community<P, Q, R>>>
Detect communities using geometric clustering
Groups nodes based on their geometric proximity in the multivector space. Uses k-means style clustering with geometric distance metric.
Sourcepub fn simulate_diffusion(
&self,
initial_sources: &[usize],
max_steps: usize,
diffusion_rate: f64,
) -> NetworkResult<PropagationAnalysis>
pub fn simulate_diffusion( &self, initial_sources: &[usize], max_steps: usize, diffusion_rate: f64, ) -> NetworkResult<PropagationAnalysis>
Simulate information diffusion through the network
Models how information spreads using geometric products between node positions. Initial information is placed at source nodes and propagates based on edge weights and geometric similarity.
Sourcepub fn spectral_clustering(
&self,
num_clusters: usize,
) -> NetworkResult<Vec<Vec<usize>>>
pub fn spectral_clustering( &self, num_clusters: usize, ) -> NetworkResult<Vec<Vec<usize>>>
Perform spectral clustering using the graph Laplacian
Uses eigenvalue decomposition of the normalized Laplacian matrix to identify community structure in the network.
Trait Implementations§
Source§impl<const P: usize, const Q: usize, const R: usize> Clone for GeometricNetwork<P, Q, R>
impl<const P: usize, const Q: usize, const R: usize> Clone for GeometricNetwork<P, Q, R>
Source§fn clone(&self) -> GeometricNetwork<P, Q, R>
fn clone(&self) -> GeometricNetwork<P, Q, R>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl<const P: usize, const Q: usize, const R: usize> Freeze for GeometricNetwork<P, Q, R>
impl<const P: usize, const Q: usize, const R: usize> RefUnwindSafe for GeometricNetwork<P, Q, R>
impl<const P: usize, const Q: usize, const R: usize> Send for GeometricNetwork<P, Q, R>
impl<const P: usize, const Q: usize, const R: usize> Sync for GeometricNetwork<P, Q, R>
impl<const P: usize, const Q: usize, const R: usize> Unpin for GeometricNetwork<P, Q, R>
impl<const P: usize, const Q: usize, const R: usize> UnwindSafe for GeometricNetwork<P, Q, R>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.