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