Skip to main content

datasynth_graph/
lib.rs

1#![cfg_attr(not(test), 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)]
30pub(crate) mod test_helpers;
31
32// Re-export builder types
33pub use builders::{
34    AccountLinkInput, ApprovalGraphBuilder, ApprovalGraphConfig, BankingGraphBuilder,
35    BankingGraphConfig, BuilderInput, ComplianceGraphBuilder, ComplianceGraphConfig,
36    ControlLinkInput, CrossReferenceEdgeInput, EntityGraphBuilder, EntityGraphConfig,
37    FilingNodeInput, FindingNodeInput, HypergraphBuilder, HypergraphConfig,
38    JurisdictionMappingInput, JurisdictionNodeInput, LayerDemand, OwnershipHierarchy,
39    OwnershipHierarchyNode, ProcedureNodeInput, SimpleApproval, StandardNodeInput,
40    SupersessionEdgeInput, TransactionGraphBuilder, TransactionGraphConfig,
41};
42
43// Re-export exporter types
44pub use exporters::{
45    CommonExportConfig, CommonGraphMetadata, CypherQueryBuilder, DGLExportConfig, DGLExporter,
46    DGLMetadata, HypergraphExportConfig, HypergraphExporter, Neo4jExportConfig, Neo4jExporter,
47    Neo4jMetadata, PyGExportConfig, PyGExporter, PyGMetadata, RawUnifiedEdge, RawUnifiedHyperedge,
48    RawUnifiedNode, RustGraphEdgeMetadata, RustGraphEdgeOutput, RustGraphExportConfig,
49    RustGraphExporter, RustGraphMetadata, RustGraphNodeMetadata, RustGraphNodeOutput,
50    RustGraphOutputFormat, RustGraphUnifiedExporter, UnifiedExportConfig,
51    UnifiedHypergraphMetadata,
52};
53
54#[cfg(feature = "rustgraph")]
55pub use exporters::RustGraphBulkExport;
56
57// Re-export ML types
58pub use ml::*;
59
60// Re-export model types
61pub use models::{
62    AccountNode, AggregationStrategy, ApprovalEdge, CompanyNode, CrossLayerEdge, EdgeDirection,
63    EdgeId, EdgeProperty, EdgeType, Graph, GraphEdge, GraphMetadata, GraphNode, GraphType,
64    HeterogeneousGraph, Hyperedge, HyperedgeParticipant, Hypergraph, HypergraphLayer,
65    HypergraphMetadata, HypergraphNode, NodeBudget, NodeBudgetReport, NodeBudgetSuggestion, NodeId,
66    NodeProperty, NodeType, OwnershipEdge, TransactionEdge, UserNode,
67};