pub struct AccountingNetwork {Show 13 fields
pub id: Uuid,
pub entity_id: Uuid,
pub fiscal_year: u16,
pub fiscal_period: u8,
pub accounts: Vec<AccountNode>,
pub account_metadata: HashMap<u16, AccountMetadata>,
pub flows: Vec<TransactionFlow>,
pub aggregated_flows: HashMap<(u16, u16), AggregatedFlow>,
pub adjacency_out: Vec<Vec<(u16, usize)>>,
pub adjacency_in: Vec<Vec<(u16, usize)>>,
pub statistics: NetworkStatistics,
pub period_start: HybridTimestamp,
pub period_end: HybridTimestamp,
}Expand description
The complete accounting network graph.
Fields§
§id: UuidNetwork identifier
entity_id: UuidEntity (company) this network belongs to
fiscal_year: u16Fiscal year
fiscal_period: u8Fiscal period (1-12 for monthly, 1-4 for quarterly)
accounts: Vec<AccountNode>Account nodes (indexed by account index 0-255)
account_metadata: HashMap<u16, AccountMetadata>Account metadata (names, codes, etc.)
flows: Vec<TransactionFlow>Transaction flows (edges)
aggregated_flows: HashMap<(u16, u16), AggregatedFlow>Aggregated flows by (source, target) pair
adjacency_out: Vec<Vec<(u16, usize)>>Adjacency list: for each account, list of (target, flow_index)
adjacency_in: Vec<Vec<(u16, usize)>>Reverse adjacency: for each account, list of (source, flow_index)
statistics: NetworkStatisticsNetwork statistics
period_start: HybridTimestampPeriod start timestamp.
period_end: HybridTimestampPeriod end timestamp.
Implementations§
Source§impl AccountingNetwork
impl AccountingNetwork
Sourcepub fn new(entity_id: Uuid, fiscal_year: u16, fiscal_period: u8) -> Self
pub fn new(entity_id: Uuid, fiscal_year: u16, fiscal_period: u8) -> Self
Create a new empty network.
Sourcepub fn add_account(
&mut self,
account: AccountNode,
metadata: AccountMetadata,
) -> u16
pub fn add_account( &mut self, account: AccountNode, metadata: AccountMetadata, ) -> u16
Add an account to the network.
Sourcepub fn add_flow(&mut self, flow: TransactionFlow)
pub fn add_flow(&mut self, flow: TransactionFlow)
Add a flow to the network.
Sourcepub fn incorporate_flows(&mut self, flows: &[TransactionFlow])
pub fn incorporate_flows(&mut self, flows: &[TransactionFlow])
Incorporate multiple flows efficiently.
Sourcepub fn update_statistics(&mut self)
pub fn update_statistics(&mut self)
Update network statistics.
Sourcepub fn neighbors(
&self,
account_index: u16,
direction: FlowDirection,
) -> Vec<u16>
pub fn neighbors( &self, account_index: u16, direction: FlowDirection, ) -> Vec<u16>
Get neighbors of an account.
Sourcepub fn get_account(&self, index: u16) -> Option<&AccountNode>
pub fn get_account(&self, index: u16) -> Option<&AccountNode>
Get account by index.
Sourcepub fn get_metadata(&self, index: u16) -> Option<&AccountMetadata>
pub fn get_metadata(&self, index: u16) -> Option<&AccountMetadata>
Get account metadata by index.
Sourcepub fn find_by_code(&self, code: &str) -> Option<u16>
pub fn find_by_code(&self, code: &str) -> Option<u16>
Find account by code.
Sourcepub fn find_by_name(&self, name: &str) -> Vec<u16>
pub fn find_by_name(&self, name: &str) -> Vec<u16>
Find account by name (partial match).
Sourcepub fn accounts_by_type(&self, account_type: AccountType) -> Vec<u16>
pub fn accounts_by_type(&self, account_type: AccountType) -> Vec<u16>
Get accounts by type.
Sourcepub fn calculate_pagerank(&mut self, damping: f64, iterations: usize)
pub fn calculate_pagerank(&mut self, damping: f64, iterations: usize)
Calculate PageRank for all nodes. Uses power iteration method.
Sourcepub fn snapshot(&self) -> NetworkSnapshot
pub fn snapshot(&self) -> NetworkSnapshot
Create a snapshot of current state for visualization.
Trait Implementations§
Source§impl Clone for AccountingNetwork
impl Clone for AccountingNetwork
Source§fn clone(&self) -> AccountingNetwork
fn clone(&self) -> AccountingNetwork
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for AccountingNetwork
impl Debug for AccountingNetwork
Source§impl From<&AccountingNetwork> for GpuNetworkHeader
impl From<&AccountingNetwork> for GpuNetworkHeader
Source§fn from(network: &AccountingNetwork) -> Self
fn from(network: &AccountingNetwork) -> Self
Auto Trait Implementations§
impl Freeze for AccountingNetwork
impl RefUnwindSafe for AccountingNetwork
impl Send for AccountingNetwork
impl Sync for AccountingNetwork
impl Unpin for AccountingNetwork
impl UnwindSafe for AccountingNetwork
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)Source§impl<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
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.