TGraphX as a Tensor-Native Graph Research Platform: Directions and Boundaries
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:
- the capability map in its README;
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);- 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:
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:
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 theRunneritem below). docs/api_stability.mdwords 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.node2vecmodule and itsNode2VecEmbeddingclass label themselves Experimental. - For classical generation and evolutionary optimization,
docs/api_stability.mdseparates the underlying classes (Beta) from thegenerate_graphandoptimize_graphwrappers (experimental). The registry also marksGeneticAlgorithmOptimizerandNSGAIIOptimizerexperimental. docs/api_stability.mdwritesGAEModel,VGAEModel,Node2Vec,DeepWalkandLabelPropagation. 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 theedge_indexyou supply.learned_implicit: set attention over node content. 1.5.0 added this family, and 1.5.1 gave its class the nameTGraphXSetAttention(SetTransformerModelremains an alias). It ignoresedge_indexand warns withTopologyIgnoredWarning.learned_explicit: helpers intgraphx.learned_graphbuild 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 readedge_indexitself. 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_sizelowers peak memory and silences the warning, but the running time stays quadratic. - Spectral partitioning is for small graphs.
SpectralPartitionerbuilds 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"),TensorGATLayergives one score per edge and head,[E, num_heads]. The Experimentalattention_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"raiseValueError. - 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:
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))
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 theGraphcontainer 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:
fitignores node masks and trains on every node in the batch. Write the loop for transductive node classification.NeighborLoaderseeds every node unless you passmask=, andmask=graph.train_maskcan still do that.RandomNodeSplit,FixedSplitand thesynthetic:node_classificationdataset store the split asmetadata["masks"]["train_mask"], butgraph.train_maskreads the keytrain. On such graphs the property isNone, so every node is seeded, andcheck_leakage(graph)reports ok after checking nothing. Read the metadata key, or assert thatgraph.train_maskis notNonebefore you use it.KGTrainerwith ComplEx, RotatE or SimplE and no sampler stops withnum_entities must be >= 2; got 1. Passsampler=UniformNegativeSampler(num_entities, num_negatives=K)fromtgraphx.kg, whereKis the number of negatives per positive you intend. A sampler you pass overrides the training config'snum_negatives, and the sampler's own default is 1.tgraphx.mining.modularityreturns wrong values; usenetworkx.community.modularity.generate_graphsilently ignores unknown keywords, and its"ws"method does not rewire.tgraphx.mining.watts_strogatz_graphdoes.tgraphx.generation.mmd_degreecompares 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_graphdefaults to a fast mode that caps the run at 3 generations and a population of 6. Passfast_mode=False.TGATConvdoes not drop edges from the future. Keep only events strictly before the query time,past = edge_time < query_time[edge_index[1]], then passedge_index[:, past]andedge_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
Runnertrains on one full batch and computes no validation loss, so early stopping onval_lossnever acts. On node tasks its loss honours onlymetadata["masks"]["train_mask"]. A mask your dataset sets withGraph(train_mask=...)is stored under the keytrainand ignored, so all labels, validation and test included, enter the loss. HeteroGraphdoes 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
GraphandGraphBatch; - knowledge graphs use
KnowledgeGraph(integer triples, optional entity features); - typed graphs use
HeteroGraph, and snapshot sequences useTemporalGraphSequence; - evolutionary search operates on
GraphGenome; - the structural functions in
tgraphx.mining(centrality, motifs, communities) takeedge_indexandnum_nodes, not aGraph.
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:
- Which of the names you imported are Experimental in any of the three sources, or in their own docstrings?
- Does any documented limit above block your data size or method?
- Does any item under "Behaviour to check" touch your pipeline, and do you have a test for it?
- 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.