Skip to main content

Module graph_models

Module graph_models 

Source
Expand description

Graph neural network embedding models (v0.3.0).

This module provides production-ready GNN implementations for knowledge graph and general graph embedding tasks:

  • graphsage: GraphSAGE - inductive representation learning via neighbor sampling with multiple aggregator strategies.
  • gat: Graph Attention Networks - multi-head attention for adaptive neighborhood aggregation.

§Quick Start

§GraphSAGE

use oxirs_embed::graph_models::graphsage::{Graph, GraphSAGEConfig, GraphSAGEModel};

let config = GraphSAGEConfig {
    input_dim: 16,
    hidden_dims: vec![32],
    output_dim: 8,
    ..Default::default()
};
let model = GraphSAGEModel::new(config)?;
// Build your graph, then:
// let embeddings = model.embed(&graph)?;

§GAT

use oxirs_embed::graph_models::gat::{GATConfig, GATModel};

let config = GATConfig {
    input_dim: 16,
    output_head_dim: 8,
    num_layers: 2,
    ..Default::default()
};
let model = GATModel::new(config)?;

Re-exports§

pub use gat::GATConfig;
pub use gat::GATEmbeddings;
pub use gat::GATModel;
pub use graphsage::AggregatorKind;
pub use graphsage::Graph;
pub use graphsage::GraphSAGEConfig;
pub use graphsage::GraphSAGEEmbeddings;
pub use graphsage::GraphSAGEModel;
pub use graphsage::LSTMAggregator;
pub use graphsage::MaxPoolAggregator;
pub use graphsage::MeanAggregator;
pub use graphsage::MeanPoolAggregator;
pub use graphsage::MiniBatchConfig;
pub use graphsage::MiniBatchGraphSAGE;
pub use graphsage::TrainingMetrics;

Modules§

gat
GAT: Graph Attention Network Embeddings (v0.3.0)
graphsage
GraphSAGE: Inductive Representation Learning on Large Graphs