TGraphX › Insights › The TGraphX Workflow Surface: APIs, CLI, Notebooks, Dashboards, and Artifacts
← Back to Insights

The TGraphX Workflow Surface: APIs, CLI, Notebooks, Dashboards, and Artifacts

Topic: APIs, tooling and research-engineering workflow

The capability map lists what TGraphX covers by task. This article maps how you drive it: the Python entry points, the command-line tools, the notebooks, the local dashboard and the files a run leaves behind, with what each one actually does. If you are just starting, read Getting Started with Tensor-Valued Nodes first.

Examples tested with TGraphX 1.5.1 on CPU.

The workflow coverage map

Stage Surface Entry point Stability
Try fast easy mode tgx.easy.train_node_classifier(...) Beta
One call UX helpers tgx.classify_nodes, tgx.kg_completion, tgx.make_graph Beta
Full control explicit layers and models tgx.Graph, tensor layers, tgx.build_model, tgx.fit Stable
Check the install doctor CLI tgraphx-doctor, python -m tgraphx Beta
Train and sweep experiment CLI tgraphx-train, tgraphx-grid, tgraphx-report Stable
Discover module CLI python -m tgraphx readiness / list-datasets / list-methods not listed
Learn by example Colab gallery, tutorial scripts docs/colab_gallery.md, tutorials/ (repository) see gallery
Inspect runs local dashboard tgraphx-dashboard Stable
Audit runs audit helpers tgx.audit_run_dir / tgx.dashboard_audit Beta
Persist artifacts and metadata write_* (Stable); .tgx files and *_card helpers (Beta) mixed

The stability column summarises docs/api_stability.md. The other sources do not fully agree with it: the README's capability map labels the experiment manager and dashboard Beta, and the in-package registry, tgx.api_status(name), covers only some names. Plan around the more cautious label.

Three API altitudes

The same task, node classification on [C, H, W] features, can be approached at three levels.

python
import torch
import tgraphx as tgx
from tgraphx.estimators import node_train_val_test_split

# Labels here are random: this data checks the pipeline, not model quality
data = tgx.easy.synthetic_tensor_node_classification(
    num_nodes=60, node_shape=(3, 8, 8), num_classes=3, seed=0)
train_mask, val_mask, test_mask = node_train_val_test_split(60, 0.6, 0.2, 0.2, seed=0)

# 1. Easy mode: returns the trained model. With the default sampler="neighbor",
#    mask picks the training seeds and the metrics are measured on those seeds.
easy = tgx.easy.train_node_classifier(data, mask=train_mask, epochs=2, seed=0,
                                      device="cpu", verbose=False)
print(sorted(easy.metrics))                       # ['accuracy', 'loss']

# The model is a plain nn.Module, so evaluate held-out nodes yourself
easy.model.eval()
with torch.no_grad():
    pred = easy.model(data.node_features, data.edge_index).argmax(1)
val_acc = (pred[val_mask] == data.node_labels[val_mask]).float().mean().item()

# 2. One-call helper: tensors in, metrics out, no model returned
result = tgx.classify_nodes(data.node_features, data.edge_index, data.node_labels,
                            train_mask=train_mask, val_mask=val_mask, test_mask=test_mask,
                            seed=0, device="cpu")
print(sorted(result.metrics))
# ['epochs', 'num_classes', 'num_nodes', 'test_accuracy', 'val_accuracy']

# 3. Explicit API: you choose the layer and write the training loop
model = tgx.build_model("node_classification", layer="sage", in_shape=(3, 8, 8),
                        hidden_shape=(16, 8, 8), num_layers=2, num_classes=3)
assert model(data.node_features, data.edge_index).shape == (60, 3)

Points that are easy to miss:

  • mask= in easy mode selects the training nodes only with the default sampler="neighbor". Without a mask, every node is used.
  • With sampler="full", 1.5.1 silently ignores mask=: every node's label, validation and test included, enters the loss, and the reported metrics cover all nodes. Do not use sampler="full" for a transductive split. Write the full-batch loop yourself with the mask in the loss, as the experiment skeleton does.
  • classify_nodes runs a 3-epoch smoke run by default (fast_mode=True). Pass epochs=, or fast_mode=False (15 epochs), before reading anything into its accuracies. On the random labels above, held-out accuracy means nothing however long you train.
  • Pass classify_nodes all three masks or none. With only train_mask, its validation accuracy is computed over all nodes, training nodes included.
  • tgx.train_node_classifier is an alias of classify_nodes; it is not the same function as tgx.easy.train_node_classifier.
  • tgx.fit does not apply node masks, so for transductive node classification write the loop yourself.

The helpers live in the tgraphx.ux layer. For the aliases and how they map to canonical names, see API Stability and Aliases. To check labels from code, api_status takes a name and public_api() returns the whole registry:

python
print(tgx.api_status("classify_nodes"), tgx.list_aliases("classify_nodes"))
print({level: len(names) for level, names in tgx.public_api().items()})
# beta ['node_classification', 'fit_node_classifier', 'train_node_classifier']
# {'stable': 40, 'beta': 62, 'experimental': 26, 'deprecated': 0}

The command line

Installing the package registers tgraphx-doctor (also tgraphx-info), tgraphx-train, tgraphx-grid, tgraphx-report and tgraphx-dashboard.

Doctor and readiness

bash
pip install tgraphx
tgraphx-doctor

Output from a CPU-only environment, trimmed (third-party warnings, local paths and the quick-start footer removed):

TGraphX Doctor — System Status
  tgraphx    : 1.5.1
  python     : 3.13.12
  torch      : 2.15.0+cpu
  CUDA       : not available

Optional dependencies:
  ✓ torch_geometric: 2.8.1
  – dgl: not installed
  – ogb: not installed
  ✓ matplotlib: 3.11.2
  ✓ mlflow: 3.18.0
  ✓ tensorboard: 2.21.0

The doctor reports versions, CUDA and optional dependencies. It does not run a forward pass or look at your data. It also prints paths for examples/ and tutorials/; the pip wheel ships only the tgraphx/ package, so get those from the repository.

bash
python -m tgraphx readiness
TGraphX Package Readiness Report
Version: 1.5.1
Torch: 2.15.0+cpu
CUDA: False (devices: 0)
...
Public API: {'stable': 40, 'beta': 62, 'experimental': 26, 'deprecated': 0}

Workflow tasks: ['graph_classification', 'graph_generation', 'graph_mining', 'kg_link_prediction', 'node_classification']
...

The full report also lists dependencies, features and known limitations. A listed workflow task is not necessarily implemented: in 1.5.1 tgx.workflow("graph_classification") and tgx.workflow("graph_generation") raise NotImplementedError. python -m tgraphx list-datasets and list-methods print dataset aliases and graph-generation methods.

Config-driven runs

Save this as smoke.yaml:

yaml
seed: 0
run_name: smoke
dataset:
  name: synthetic:node_classification
  kwargs: {seed: 0}
model:
  task: node_classification
  layer: linear
  in_shape: [16]
  hidden_shape: [16]
  num_layers: 2
  num_classes: 4
training:
  epochs: 3
  lr: 0.01
bash
tgraphx-train smoke.yaml --run-dir runs/smoke
tgraphx-report runs
Run finished: runs/smoke
  epoch=0, train_loss=2.7761118412017822
  epoch=1, train_loss=1.236585021018982
  epoch=2, train_loss=0.6493671536445618
Wrote runs/report.md (1 runs)

Your loss values may differ. This runner is meant for quick runs: it trains on one full batch of a registry dataset and records a training loss only, with no validation loss. See building an experiment from a YAML config for what that means in practice.

Notebooks and tutorials

The Colab gallery lists numbered notebooks by topic, from easy mode and sampling to knowledge graphs and graph mining. Most are Google Drive links and a few are local drafts you regenerate from the repository. The gallery describes its core notebooks as CPU-runnable on synthetic or toy data, and has a separate section of longer real-dataset projects. Notebook 26 shows the "escape hatch" from an EasyResult to raw PyTorch. Tutorial scripts live in the repository's tutorials/ directory.

Dashboard and run artifacts

A run directory is a folder of files that you write. Nothing is collected unless you call a writer or logger:

python
from tgraphx import CSVLogger, write_run_metadata, write_metrics_summary, audit_run_dir
from tgraphx.dashboard.app import export_dashboard_html

run = "runs/surface"
with CSVLogger(run) as logger:
    logger.log(epoch=0, train_loss=1.0, val_loss=1.1)       # illustrative numbers
write_run_metadata(f"{run}/run_metadata.json", seed=0, device="cpu",
                   tgraphx_version=tgx.__version__)
write_metrics_summary(f"{run}/metrics_summary.json", val_accuracy=val_acc)
tgx.save_tgraphx(data, f"{run}/graph.tgx")                  # tensor-valued features kept

audit = audit_run_dir(run)
print(audit["ok"], audit["files_missing"])    # False ['benchmark_summary.json']
export_dashboard_html(run, "runs/surface.html")

tgraphx-dashboard --logdir runs/surface serves a read-only local view (by default on 127.0.0.1), and --export-html out.html writes an offline snapshot like the call above.

audit_run_dir and dashboard_audit check that expected JSON files are present and well formed, here flagging the missing benchmark summary. They also return completeness_score, reproducibility_score, portability_score and scientific_reporting_score (0-100). These are simple heuristics over file names and keys; for example, the reproducibility score looks for seed, tgraphx_version and device in run_metadata.json. A high score says nothing about whether the experiment is sound.

For the file formats, see Serializing Tensor Graphs; for summaries of a model, dataset or result, there are tgx.model_card, tgx.dataset_card and tgx.benchmark_card.

Honest framing

The convenience layers (easy mode, the UX helpers, audit and .tgx helpers) are Beta. The dashboard is a local, read-only viewer, not a hosted experiment-tracking service. Broad coverage of entry points is not depth in each: the CLI covers common flows, not every option, and anything unusual is likely to need the explicit API or plain PyTorch.

A new user's first hour

  1. pip install tgraphx, then tgraphx-doctor to see versions and optional dependencies.
  2. Run one easy-mode call on synthetic data, or the matching gallery notebook.
  3. Use tgx.public_api() and tgx.api_status("Graph") to see the labels of the calls you plan to use.
  4. Move to Graph and the explicit layers for your real model, with your own train, validation and test masks.
  5. Seed the run with tgraphx.reproducibility.set_seed and write the artifacts, so the first real result can be traced later.

Profile and tune later. First confirm that the pieces run and return what you expect.

Related guides

Conclusion

TGraphX can be driven at three Python levels (easy mode, one-call helpers, explicit layers), from the command line (doctor, readiness, train, grid, report, dashboard), and through notebooks. Pick the level that gives you the control the task needs, and check what each convenience actually measures before you quote its numbers.