GeometricNetwork

Struct GeometricNetwork 

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

Source

pub fn new() -> Self

Create a new empty geometric network

Source

pub fn with_capacity(num_nodes: usize, num_edges: usize) -> Self

Create a network with pre-allocated capacity

Source

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.

Source

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.

Source

pub fn add_edge( &mut self, source: usize, target: usize, weight: f64, ) -> NetworkResult<()>

Add a directed edge between two nodes

Source

pub fn add_undirected_edge( &mut self, a: usize, b: usize, weight: f64, ) -> NetworkResult<()>

Add an undirected edge (creates two directed edges)

Source

pub fn num_nodes(&self) -> usize

Get the number of nodes in the network

Source

pub fn num_edges(&self) -> usize

Get the number of edges in the network

Source

pub fn get_node(&self, index: usize) -> Option<&Multivector<P, Q, R>>

Get a reference to a node’s position

Source

pub fn get_metadata(&self, index: usize) -> Option<&NodeMetadata>

Get metadata for a node

Source

pub fn neighbors(&self, node: usize) -> Vec<usize>

Get all neighbors of a node

Source

pub fn degree(&self, node: usize) -> usize

Get the degree (number of outgoing edges) of a node

Source

pub fn edges(&self) -> &[GeometricEdge]

Get all edges in the network

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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>

Source§

fn clone(&self) -> GeometricNetwork<P, Q, R>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<const P: usize, const Q: usize, const R: usize> Debug for GeometricNetwork<P, Q, R>

Source§

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

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

impl<const P: usize, const Q: usize, const R: usize> Default for GeometricNetwork<P, Q, R>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto 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> 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.