AiModelResultGraphExtensions

Helpers & Utilities ยท AiDotNet.Graphs.Extensions

Model-specific inference extensions on AiModelResult for the graph neural network family (GCN, GAT, GraphSAGE, etc. wrapped as NodeClassificationModel). Part of #1836.

How It Works

See AiModelResultRadianceFieldExtensions for the full design rationale โ€” extension methods live in the same assembly as AiModelResult so they access internal Model directly without exposing it.

Methods

Method Summary
T PredictLink(AiModelResult<T, TInput, TOutput> result, Tensor<T> adjacencyMatrix, Tensor<T> nodeFeatures, int sourceNode, int targetNode, LinkScorer scorer) Predicts a link (edge) score between two nodes by combining their post-embedding representations through the selected scorer.
Task<Tensor<T>> PredictOnGraphAsync(AiModelResult<T, TInput, TOutput> result, Tensor<T> adjacencyMatrix, Tensor<T> nodeFeatures, CancellationToken cancellationToken) Async graph inference for pipelines that need to score many graphs concurrently without blocking the caller.
Tensor<T> PredictOnGraph(AiModelResult<T, TInput, TOutput> result, Tensor<T> adjacencyMatrix, Tensor<T> nodeFeatures) Runs graph-aware inference: binds the adjacency matrix into every graph-convolutional layer, then forwards the node features through the network.
Tensor<T>[] PredictOnGraphBatch(AiModelResult<T, TInput, TOutput> result, IEnumerable<ValueTuple<Tensor<T>, Tensor<T>>> graphs) Batched graph inference: score N graphs by iterating the pairs.