GNN Explainability
graph-explain
[ Open Source ][ Beta ]
Explain GNN predictions — nodes, edges and subgraphs that matter
graph-explain is an explainability library for Graph Neural Networks: a single Explainer covers node-level and graph-level predictions with 14 methods, built-in metrics, BA-Shapes benchmarks with ground truth, narration and visualization, and PyG/DGL backends. CLI and Python API with comparative benchmarking.
// Features
- Unified Explainer: explain_node and explain_graph over 14 methods — GNNExplainer, PGExplainer, SubgraphX, Saliency, Integrated Gradients, GNNGatedLRP, DeepLift, Attention, GradXInput, GraphLIME, NodeMask, GuidedBackprop, Counterfactual and Random baseline
- Metrics: sparsity (global/local k-hop), fidelity+ (necessity), fidelity- (sufficiency), stability under perturbations, and GEA (graph explanation accuracy) vs ground-truth motifs — plus graph-level evaluate_gea_graph
- Built-in benchmarks: BA-Shapes synthetic generator with ground_truth_nodes/edge_ids, and build_graph_classification for graph-level gt_edge_mask — with compare() for head-to-head evaluation
- Narration: describe() template (Spanish by default) and narrate(llm=...) for generative models, plus visualization static (matplotlib+networkx) and interactive (pyvis → HTML)
- Backends PyTorch Geometric and DGL (adapter) — CLI graph-explain explain/bench with --plot/--html/--json, threshold/top-k, and HTML reports
- Python 3.10–3.12, MIT, 0.8.0 on PyPI — torch + networkx + matplotlib, extras [pyg], [dgl], [interactive], [all]
// Technologies
PythonPyTorchPyGDGLnetworkxmatplotlib