1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
//! GraphSAGE encoder for knowledge-graph entity embeddings.
//!
//! This module implements **phase a** of the hybrid GNN+LLM architecture:
//! a two-layer GraphSAGE encoder with hand-rolled forward + backward passes
//! and an unsupervised link-prediction training objective.
//!
//! # Usage
//!
//! ```rust
//! use oxirs_graphrag::gnn_encoder::{GraphSageConfig, GraphSageEncoder, KgGraph};
//! use scirs2_core::ndarray_ext::Array2;
//!
//! let graph = KgGraph {
//! num_nodes: 4,
//! edges: vec![(0, 1), (1, 2), (2, 3), (3, 0)],
//! node_features: Array2::zeros((4, 8)),
//! };
//!
//! let config = GraphSageConfig {
//! input_dim: 8,
//! hidden_dim: 16,
//! output_dim: 16,
//! num_layers: 2,
//! dropout: 0.0,
//! k_neighbors: 4,
//! learning_rate: 0.01,
//! };
//!
//! let encoder = GraphSageEncoder::new(&config).expect("construct");
//! let embeddings = encoder.encode(&graph).expect("encode");
//! assert_eq!(embeddings.embeddings.nrows(), 4);
//! assert_eq!(embeddings.embeddings.ncols(), 16);
//! ```
// ── Original GraphSAGE submodules ───────────────────────────────────────────
// ── New GNN encoder submodules (v0.3.1) ─────────────────────────────────────
// ── Re-exports: original GraphSAGE ─────────────────────────────────────────
pub use ;
// ── Re-exports: new GNN components ─────────────────────────────────────────
pub use ;
pub use ScaledDotProductAttention;
pub use ;