oxirs_embed/graph_models/mod.rs
1//! Graph neural network embedding models (v0.3.0).
2//!
3//! This module provides production-ready GNN implementations for
4//! knowledge graph and general graph embedding tasks:
5//!
6//! - [`graphsage`]: GraphSAGE - inductive representation learning via
7//! neighbor sampling with multiple aggregator strategies.
8//! - [`gat`]: Graph Attention Networks - multi-head attention for
9//! adaptive neighborhood aggregation.
10//!
11//! ## Quick Start
12//!
13//! ### GraphSAGE
14//! ```rust,no_run
15//! use oxirs_embed::graph_models::graphsage::{Graph, GraphSAGEConfig, GraphSAGEModel};
16//!
17//! # fn main() -> anyhow::Result<()> {
18//! let config = GraphSAGEConfig {
19//! input_dim: 16,
20//! hidden_dims: vec![32],
21//! output_dim: 8,
22//! ..Default::default()
23//! };
24//! let model = GraphSAGEModel::new(config)?;
25//! // Build your graph, then:
26//! // let embeddings = model.embed(&graph)?;
27//! # Ok(())
28//! # }
29//! ```
30//!
31//! ### GAT
32//! ```rust,no_run
33//! use oxirs_embed::graph_models::gat::{GATConfig, GATModel};
34//!
35//! # fn main() -> anyhow::Result<()> {
36//! let config = GATConfig {
37//! input_dim: 16,
38//! output_head_dim: 8,
39//! num_layers: 2,
40//! ..Default::default()
41//! };
42//! let model = GATModel::new(config)?;
43//! # Ok(())
44//! # }
45//! ```
46
47pub mod gat;
48pub mod graphsage;
49
50// Re-export commonly used types for convenience
51pub use gat::{GATConfig, GATEmbeddings, GATModel};
52pub use graphsage::{
53 AggregatorKind, Graph, GraphSAGEConfig, GraphSAGEEmbeddings, GraphSAGEModel, LSTMAggregator,
54 MaxPoolAggregator, MeanAggregator, MeanPoolAggregator, MiniBatchConfig, MiniBatchGraphSAGE,
55 TrainingMetrics,
56};