TGraphX › Insights › TGraphX as a Tensor-Native Graph Research Platform: Directions and Boundaries
← Back to Insights

TGraphX as a Tensor-Native Graph Research Platform: Directions and Boundaries

Topic: APIs, tooling and research-engineering workflow

TGraphX is a tensor-native graph-learning library for PyTorch: node features can stay [C, H, W] image-like maps or [C, D, H, W] volumes through message passing, and plain [D] vectors work too. As a research platform it reaches well beyond layers, into knowledge graphs, mining, generation, graph reinforcement learning and run records. Before you depend on one of those directions, it helps to know two things: how mature it is and where it stops. This page answers both for TGraphX 1.5.1, a Beta package that requires Python 3.10+ and PyTorch 1.13+. For a task-by-task tour with further reading, use the capability map. Examples tested with TGraphX 1.5.1 on CPU.

Three sources of stability labels

TGraphX publishes stability labels in three places:

  1. the capability map in its README;
  2. docs/api_stability.md, which the README calls the detailed per-component stability contract (it is in the GitHub repository, not in the installed wheel);
  3. a registry you can query with tgx.api_status().

The README defines Stable as a public API that will not change in v1.x, Beta as tested and documented with an API that is stable within v1.x but may expand, and Experimental as correct foundations whose API or semantics may still change.

The three do not always agree, and the registry is a hand-kept list that raises KeyError for many real names. Some docstrings carry a label of their own as well. Query the names you actually import:

python
import tgraphx as tgx
from tgraphx.kg import KGTrainer

names = ["Graph", "TensorGATLayer", "TGraphXSetAttention", "NeighborLoader",
         "TransEModel", "ComplExModel", "KGTrainer", "generate_graph",
         "optimize_graph", "GeneticAlgorithmOptimizer", "HeteroGraph",
         "TemporalGraphSequence", "TGATConv", "GraphPipeline", "Runner"]

for name in names:
    try:
        status = tgx.api_status(name)
    except KeyError:
        status = "not in the registry"
    print(f"{name:26s} {status}")

# A docstring can carry its own label.
print([line.strip() for line in KGTrainer.__doc__.splitlines() if "Stability" in line])

Output with 1.5.1:

text
Graph                      stable
TensorGATLayer             stable
TGraphXSetAttention        stable
NeighborLoader             beta
TransEModel                beta
ComplExModel               experimental
KGTrainer                  beta
generate_graph             experimental
optimize_graph             experimental
GeneticAlgorithmOptimizer  experimental
HeteroGraph                experimental
TemporalGraphSequence      experimental
TGATConv                   not in the registry
GraphPipeline              not in the registry
Runner                     not in the registry
['Stability: Experimental.']

KGTrainer is Beta in the registry and in docs/api_stability.md, while its own docstring says Experimental.

Directions and their stability labels

The three tables below put the sources side by side, area by area. "No row" means the README capability map has no entry for the area, and "not listed" means a source does not name it. Tutorials, benchmark scripts, plotting and the doctor/info command-line tools are left out.

Core library

Area and representative names README capability map docs/api_stability.md api_status()
Graph containers: Graph, GraphBatch Beta; also listed under "Stable core APIs" Stable stable
Spatial and vision graphs: image_to_patches, volume_to_patches, build_grid_graph, build_knn_graph, CNNEncoder no row; CNNEncoder is under "Stable core APIs" graph builders and patch helpers Stable; CNNEncoder not listed grid and kNN builders stable; patch helpers and CNNEncoder not listed
Tensor and vector layers: ConvMessagePassing, tensor GAT/SAGE/GIN, GCNConv Beta; also listed under "Stable core APIs" Stable stable
Set attention: TGraphXSetAttention no row Stable stable
Models and factories: NodeClassifier, GraphClassifier, build_model, make_layer no row; listed under "Stable core APIs" Stable not listed
Training utilities: fit, train_epoch, evaluate, save_checkpoint no row Stable fit, train_epoch and evaluate stable; save_checkpoint not listed
Datasets, transforms, metrics: tgraphx.datasets, tgraphx.transforms, tgraphx.metrics no row Stable (registry functions, synthetic and folder datasets, transforms, metrics) a few dataset adapters beta; get_dataset not listed
Sampling and feature stores: NeighborLoader, LinkNeighborLoader, GraphSAINT, Cluster-GCN Beta loaders and stores Beta; tgraphx.sampling functions Stable neighbor loaders and feature stores beta; GraphSAINT and Cluster-GCN not listed
Sparse backend: tgraphx.sparse Beta not listed not listed

The spatial row is the vision route: cut images or volumes into patches, connect them, and run tensor layers on the result. Graph learning for computer vision walks through the image case.

Research directions

Area and representative names README capability map docs/api_stability.md api_status()
Knowledge-graph embeddings: TransE, DistMult, ComplEx, RotatE Beta Beta TransE and DistMult beta; ComplEx and RotatE experimental
KG extensions: KGRGCNModel, MultimodalKGModel, reasoning Beta Experimental KGRGCNModel experimental; MultimodalKGModel not listed
Mining and algorithms: tgraphx.mining, tgraphx.algorithms Beta algorithms and structural mining Beta; neural mining Experimental only a few functions listed (beta)
Representation learning: Node2VecEmbedding, deepwalk_walks Beta Beta not listed
Semi-supervised: label_propagation, LabelPropagationClassifier Beta Beta not listed
Classical generation: generator classes, generate_graph Beta classes Beta; generate_graph wrapper experimental generate_graph experimental
Neural generation: VGAE and autoregressive generators Experimental Experimental experimental
Graph autoencoders: GraphAutoencoder, VGAE in tgraphx.mining Experimental Experimental not listed
Evolutionary optimization: GA and annealing optimizers, optimize_graph Beta optimizer classes Beta; optimize_graph wrapper experimental optimize_graph, GeneticAlgorithmOptimizer and NSGAIIOptimizer experimental
Graph reinforcement learning: run_graph_rl, train_graph_rl, agents Experimental (random and greedy baselines Beta) Experimental (random and greedy baselines and RL callbacks Beta) experimental where listed
Heterogeneous and temporal: HeteroGraph, RGCN, HAN, HGT, TGATConv, TGNMemory Experimental containers and layers Experimental experimental for the containers
Hypergraphs: Hypergraph, clique_expansion, star_expansion Experimental Experimental not listed
Graph sequence models: GraphSequenceEncoder, GraphRNNEdgeGenerator no row Experimental not listed

Three boundaries to plan around: run_kg_hpo is a lightweight grid or random search, so use a dedicated knowledge-graph library for large-scale tuning; for reinforcement learning that is not about graphs, use a general library such as Stable-Baselines3 or RLlib; and evolutionary search is stochastic, so report results over several seeds.

Workflow, records and reliability

Area and representative names README capability map docs/api_stability.md api_status()
Easy Mode and UX helpers: tgraphx.easy, classify_nodes, validate_graph, check_leakage Easy Mode Beta; no row for the UX helpers Beta beta
Sklearn-like API and calibration: GraphPipeline, estimator base classes, tgraphx.calibration Beta Experimental not listed
Experiment manager and dashboard: Runner, GridRunner, tgraphx-dashboard Beta Stable not listed
Run logging: CSVLogger, metadata writers no row Stable CSVLogger and some writers stable
Graph I/O: write_graphml, read_graphml, .tgx save and load no row Beta save and load beta; GraphML functions not listed
Explainability: saliency, integrated gradients, edge attribution Beta Beta not listed
Reproducibility and run audit: set_seed, reproducible, audit_run_dir Beta Beta (set_seed also listed as Stable) set_seed stable; the other two beta
Distributed helpers: tgraphx.distributed Experimental Experimental not listed
OGB / TGB evaluator wrappers Beta (optional) Beta (optional) not listed

tgraphx.interop, tgraphx.learned_graph and tgraphx.performance carry no label in any of these sources or in their docstrings.

Where the sources disagree

Plan around the most cautious label, which means checking all three and the docstring. The differences most likely to change a decision:

  • The sklearn-like API, calibration and the knowledge-graph extensions are Beta in the README but Experimental in docs/api_stability.md.
  • The experiment manager, dashboard CLI and metadata writers go the other way: Stable in docs/api_stability.md, while the README's experiment-manager and dashboard rows say Beta. Stable promises no breaking changes in v1.x, not that the feature does what your experiment needs (see the Runner item below).
  • docs/api_stability.md words Beta two ways. The policy summary at its top promises stability only within a minor version ("v1.0.x"), while its Beta section, like the README, says v1.x. Plan on the weaker promise and recheck Beta APIs before a minor-version upgrade.
  • ComplEx and RotatE are Beta in both documents and experimental only in the registry.
  • Node2Vec and DeepWalk are Beta in both documents, but the tgraphx.mining.node2vec module and its Node2VecEmbedding class label themselves Experimental.
  • For classical generation and evolutionary optimization, docs/api_stability.md separates the underlying classes (Beta) from the generate_graph and optimize_graph wrappers (experimental). The registry also marks GeneticAlgorithmOptimizer and NSGAIIOptimizer experimental.
  • docs/api_stability.md writes GAEModel, VGAEModel, Node2Vec, DeepWalk and LabelPropagation. None of those is an importable name in 1.5.1; use the names in the tables.

Where relations come from

Not every model needs a trusted edge_index. Version 1.5.0 added a vocabulary for the source of a model's relations (tgx.TOPOLOGY_SOURCES, tgx.topology_source_of, and a topology_source attribute on build_model outputs). Four of its values matter here:

  • given: message-passing layers, tensor or vector, use the edge_index you supply.
  • learned_implicit: set attention over node content. 1.5.0 added this family, and 1.5.1 gave its class the name TGraphXSetAttention (SetTransformerModel remains an alias). It ignores edge_index and warns with TopologyIgnoredWarning.
  • learned_explicit: helpers in tgraphx.learned_graph build edges that a given-topology layer can then use.
  • hybrid: GraphTransformerLayer(edge_bias=True) applies global attention with a dense [N, N] bias (edge_bias_dense) that you can build from your graph. It does not read edge_index itself. This layer is Experimental and takes vector features [N, D] only. Import it from its module, from tgraphx.layers.graph_transformer import GraphTransformerLayer; you will not find it in the registry or in the README capability map.

Of these, only the set-attention family and the vocabulary itself are new in 1.5. Message passing over a supplied graph, tgraphx.learned_graph and GraphTransformerLayer with edge_bias all existed before 1.5.0; the vocabulary only classifies them, so a 1.4.x installation already has all three.

A default that changed in 1.5.0

CNNEncoder and the convolutional aggregator of ConvMessagePassing used to apply dropout 0.3 silently. The default is now 0.0, and omitting the value emits a DropoutDefaultChangeWarning. To reproduce the dropout behaviour of 1.4.2 or earlier, set 0.3: dropout_prob=0.3 on the class, or dropout=0.3 in build_model and make_layer for layer="conv" only. For "linear" and "gat", dropout= adds dropout that this change never involved. Do not copy the number from an old factory config. Before 1.5.0, build_model(layer="conv", dropout=X) and make_layer("conv", ..., dropout=X) ignored X, so conv layers built that way always used 0.3. CNNEncoder.legacy(...) restores the old encoder defaults.

Limits the project documents

The README section "Maturity and scope" names these. The warning thresholds, default values and attention modes added here come from the 1.5.1 source.

  • Dense graph builders are O(N²). The kNN and radius builders warn above 10,000 nodes, the fully-connected and IoU builders above 5,000. For kNN, radius and IoU, setting chunk_size lowers peak memory and silences the warning, but the running time stays quadratic.
  • Spectral partitioning is for small graphs. SpectralPartitioner builds a dense matrix and by default refuses more than 4,096 nodes (max_nodes).
  • No per-pixel or per-voxel GAT scores. By default (attention_mode="scalar"), TensorGATLayer gives one score per edge and head, [E, num_heads]. The Experimental attention_mode="channel" gives one per edge, head and channel, [E, num_heads, head_channels]. Per-pixel and per-voxel modes are not implemented: "spatial" and "voxel" raise ValueError.
  • Distributed training: DDP-aware helpers and a validated two-process CPU/gloo smoke path. Broader multi-node training is a roadmap item.
  • GraphSAINT and Cluster-GCN: Beta foundations; production-scale benchmarks are still to be expanded.
  • HAN, HGT, TGN, TGAT: Experimental, with unit, toy-overfit and no-leakage validation. Broader reference-parity comparisons remain future work. For TGN the package ships the memory module TGNMemory, not a complete TGN model.

Two of these are cheap to confirm:

python
import torch
from tgraphx import Graph, SpectralPartitioner, TensorGATLayer

n = 4097
chain = torch.stack([torch.arange(n - 1), torch.arange(1, n)])
try:
    SpectralPartitioner(2).fit(Graph(node_features=torch.zeros(n, 1), edge_index=chain))
except ValueError as err:
    print(str(err).split(".")[0])

x = torch.randn(6, 3, 8, 8)
edge_index = torch.tensor([[0, 1, 2, 3, 4], [1, 2, 3, 4, 5]])
out, attention = TensorGATLayer(3, 8, num_heads=2)(x, edge_index, return_attention=True)
print(tuple(out.shape), tuple(attention.shape))

channel_gat = TensorGATLayer(3, 8, num_heads=2, attention_mode="channel")   # Experimental
_, channel_attention = channel_gat(x, edge_index, return_attention=True)
print(tuple(channel_attention.shape))
text
SpectralPartitioner: num_nodes=4097 > max_nodes=4096
(6, 8, 8, 8) (5, 2)
(5, 2, 4)

Roadmap items that are not shipped

docs/api_stability.md lists these as not yet shipped, so do not plan a project around them in 1.5.1:

  • Arbitrary-rank tensors across layers. Message-passing layers are written for [D], [C, H, W] or [C, D, H, W] node features, even though the Graph container can store other ranks.
  • A full automatic multi-GPU training framework. You set up distributed training yourself.
  • Raw-text tokenization in the multimodal knowledge-graph model. It takes precomputed text vectors.
  • Per-pixel and per-voxel GAT attention, as described above.

Behaviour to check before relying on a feature

These are not part of the README list. They were observed while testing 1.5.1, and each can change a result or stop a run:

  • fit ignores node masks and trains on every node in the batch. Write the loop for transductive node classification.
  • NeighborLoader seeds every node unless you pass mask=, and mask=graph.train_mask can still do that. RandomNodeSplit, FixedSplit and the synthetic:node_classification dataset store the split as metadata["masks"]["train_mask"], but graph.train_mask reads the key train. On such graphs the property is None, so every node is seeded, and check_leakage(graph) reports ok after checking nothing. Read the metadata key, or assert that graph.train_mask is not None before you use it.
  • KGTrainer with ComplEx, RotatE or SimplE and no sampler stops with num_entities must be >= 2; got 1. Pass sampler=UniformNegativeSampler(num_entities, num_negatives=K) from tgraphx.kg, where K is the number of negatives per positive you intend. A sampler you pass overrides the training config's num_negatives, and the sampler's own default is 1.
  • tgraphx.mining.modularity returns wrong values; use networkx.community.modularity.
  • generate_graph silently ignores unknown keywords, and its "ws" method does not rewire. tgraphx.mining.watts_strogatz_graph does.
  • tgraphx.generation.mmd_degree compares degree vectors in node-index order, not degree distributions, so two isomorphic graphs can score above zero. Do not report it as standard MMD.
  • optimize_graph defaults to a fast mode that caps the run at 3 generations and a population of 6. Pass fast_mode=False.
  • TGATConv does not drop edges from the future. Keep only events strictly before the query time, past = edge_time < query_time[edge_index[1]], then pass edge_index[:, past] and edge_time[past]. An inclusive <= would keep events stamped at the query time, which can include the interaction you are predicting. The temporal graph guide shows the call.
  • The experiment manager's Runner trains on one full batch and computes no validation loss, so early stopping on val_loss never acts. On node tasks its loss honours only metadata["masks"]["train_mask"]. A mask your dataset sets with Graph(train_mask=...) is stored under the key train and ignored, so all labels, validation and test included, enter the loss.
  • HeteroGraph does not check that edge indices are in range.

Separate containers for separate directions

The areas above do not all share one data object:

  • homogeneous graphs with tensor features use Graph and GraphBatch;
  • knowledge graphs use KnowledgeGraph (integer triples, optional entity features);
  • typed graphs use HeteroGraph, and snapshot sequences use TemporalGraphSequence;
  • evolutionary search operates on GraphGenome;
  • the structural functions in tgraphx.mining (centrality, motifs, communities) take edge_index and num_nodes, not a Graph.

Moving from one direction to another means converting data explicitly. Native .tgx saving covers Graph and KnowledgeGraph only.

The same care applies to run records. Seeding functions, the metadata writers and the dashboard are available, but nothing records an experiment unless you call it, audit_run_dir checks files and JSON shape rather than scientific validity, and a fixed seed does not guarantee identical numbers on different hardware. In tgraphx.explain, the saliency, integrated-gradients and edge-attribution functions are gradient or perturbation based. attention_to_edge_scores only summarizes GAT attention weights, which do not measure sensitivity. None of them establishes causes.

A short adoption trial

If you are deciding for a group, run one real problem end to end before comparing feature lists. Build your graphs, train with the layers you expect to keep, save a .tgx file, and write the run records. Then answer four questions:

  1. Which of the names you imported are Experimental in any of the three sources, or in their own docstrings?
  2. Does any documented limit above block your data size or method?
  3. Does any item under "Behaviour to check" touch your pipeline, and do you have a test for it?
  4. Can a colleague repeat the run from what was written to disk?

The shape-checked experiment skeleton gives a starting point for the trial. Pin tgraphx==1.5.1 for the duration, and query the labels again after any upgrade.

None of these labels is a performance claim. A label describes how settled a feature is, not whether it will help on your data; that you have to measure.

Related guides