Skip to main content

datasynth_graph/
lib.rs

1#![deny(clippy::unwrap_used)]
2//! # synth-graph
3//!
4//! Graph/network export library for synthetic accounting data.
5//!
6//! This crate provides:
7//! - Graph models for representing accounting data as networks
8//! - Builders for creating transaction, approval, and entity graphs
9//! - Exporters for PyTorch Geometric, Neo4j, and DGL formats
10//! - ML utilities for feature extraction and dataset splitting
11//!
12//! ## Graph Types
13//!
14//! - **Transaction Network**: Accounts/entities as nodes, transactions as edges
15//! - **Approval Network**: Users as nodes, approvals as edges (for SoD detection)
16//! - **Entity Relationship**: Legal entities with ownership edges
17//!
18//! ## Export Formats
19//!
20//! - **PyTorch Geometric**: node_features.pt, edge_index.pt, edge_attr.pt
21//! - **Neo4j**: CSV files with Cypher import scripts
22//! - **DGL**: Compatible format for Deep Graph Library
23
24pub mod builders;
25pub mod exporters;
26pub mod ml;
27pub mod models;
28
29#[cfg(test)]
30#[allow(clippy::unwrap_used)]
31pub(crate) mod test_helpers;
32
33// Re-export builder types
34pub use builders::{
35    ApprovalGraphBuilder, ApprovalGraphConfig, BankingGraphBuilder, BankingGraphConfig,
36    EntityGraphBuilder, EntityGraphConfig, HypergraphBuilder, HypergraphConfig, OwnershipHierarchy,
37    OwnershipHierarchyNode, SimpleApproval, TransactionGraphBuilder, TransactionGraphConfig,
38};
39
40// Re-export exporter types
41pub use exporters::{
42    CommonExportConfig, CommonGraphMetadata, CypherQueryBuilder, DGLExportConfig, DGLExporter,
43    DGLMetadata, HypergraphExportConfig, HypergraphExporter, Neo4jExportConfig, Neo4jExporter,
44    Neo4jMetadata, PyGExportConfig, PyGExporter, PyGMetadata, RawUnifiedEdge, RawUnifiedHyperedge,
45    RawUnifiedNode, RustGraphEdgeMetadata, RustGraphEdgeOutput, RustGraphExportConfig,
46    RustGraphExporter, RustGraphMetadata, RustGraphNodeMetadata, RustGraphNodeOutput,
47    RustGraphOutputFormat, RustGraphUnifiedExporter, UnifiedExportConfig,
48    UnifiedHypergraphMetadata,
49};
50
51// Re-export ML types
52pub use ml::*;
53
54// Re-export model types
55pub use models::{
56    AccountNode, AggregationStrategy, ApprovalEdge, CompanyNode, CrossLayerEdge, EdgeDirection,
57    EdgeId, EdgeProperty, EdgeType, Graph, GraphEdge, GraphMetadata, GraphNode, GraphType,
58    HeterogeneousGraph, Hyperedge, HyperedgeParticipant, Hypergraph, HypergraphLayer,
59    HypergraphMetadata, HypergraphNode, NodeBudget, NodeBudgetReport, NodeId, NodeProperty,
60    NodeType, OwnershipEdge, TransactionEdge, UserNode,
61};