Package: greatx
GreatX: Graph Reliability ToolboxGreatX is great![Documentation]|[Examples]❓ What is Reliability on Graphs?It refers to robustness against the following threats:Inherent noiseDistribution ShiftAdversarial AttacksFor more details, please refer to our paperRecent Advances in Reliable Deep Graph Learning: Adversarial Attack, Inherent Noise, and Distribution Shift💨 NewsJune 30, 2022: GraphWar has been renamed to GreatX.June 9, 2022: GraphWarv0.1.0has been released. We also provide thedocumentationalong with numerousexamples.May 27, 2022: GraphWar has been refactored withPyTorch Geometric (PyG), old code based onDGLcan be foundhere. We will soon release the first version of GreatX, stay tuned!NOTE: GreatX is still in the early stages and the API will likely continue to change.
If you are interested in this project, don't hesitate to contact me or make a PR directly.🚀 InstallationPlease make sure you have installedPyTorchandPyTorch Geometric (PyG).# Coming soonpipinstall-Ugreatxor# Recommendedgitclonehttps://github.com/EdisonLeeeee/GreatX.git&&cdGreatX
pipinstall-e.--verbosewhere-emeans "editable" mode so you don't have to reinstall every time you make changes.⚡ Get StartedAssume that you have atorch_geometric.data.Datainstancedatathat describes your graph.How fast can we train and evaluate your own GNN?TakeGCNas an example:fromgreatx.nn.modelsimportGCNfromgreatx.training.trainerimportTrainerfromtorch_geometric.datasetsimportPlanetoiddataset=Planetoid(root='.',name='Cora')# Any PyG dataset is available!data=dataset[0]model=GCN(data.x.size(-1),data.y.max().item()+1)trainer=Trainer(model,device='cuda:0')trainer.fit({'data':data,'mask':data.train_mask})trainer.evaluate({'data':data,'mask':data.test_mask})A simple targeted manipulation attackfromgreatx.attack.targetedimportRandomAttackattacker=RandomAttack(data)attacker.attack(1,num_budgets=3)# attacking target node `1` with `3` edgesattacked_data=attacker.data()edge_flips=attacker.edge_flips()A simple untargeted (non-targeted) manipulation attackfromgreatx.attack.untargetedimportRandomAttackattacker=RandomAttack(data)attacker.attack(num_budgets=0.05)# attacking the graph with 5% edges perturbationsattacked_data=attacker.data()edge_flips=attacker.edge_flips()👀 ImplementationsIn detail, the following methods are currently implemented:⚔ Adversarial AttackGraph Manipulation Attack (GMA)Targeted AttackMethodsDescriptionsExamplesRandomAttackA simple random method that chooses edges to flip randomly.[Example]DICEAttackWaniek et al.Hiding Individuals and Communities in a Social Network,Nature Human Behavior'16[Example]NettackZügner et al.Adversarial Attacks on Neural Networks for Graph Data,KDD'18[Example]FGAttackChen et al.Fast Gradient Attack on Network Embedding,arXiv'18[Example]GFAttackChang et al.A Restricted Black - box Adversarial Framework Towards Attacking Graph Embedding Models,AAAI'20[Example]IGAttackWu et al.Adversarial Examples on Graph Data: Deep Insights into Attack and Defense,IJCAI'19[Example]SGAttackLi et al.Adversarial Attack on Large Scale Graph,TKDE'21[Example]Untargeted AttackMethodsDescriptionsExamplesRandomAttackA simple random method that chooses edges to flip randomly[Example]DICEAttackWaniek et al.Hiding Individuals and Communities in a Social Network,Nature Human Behavior'16[Example]FGAttackChen et al.Fast Gradient Attack on Network Embedding,arXiv'18[Example]MetattackZügner et al.Adversarial Attacks on Graph Neural Networks via Meta Learning,ICLR'19[Example]IGAttackWu et al.Adversarial Examples on Graph Data: Deep Insights into Attack and Defense,IJCAI'19[Example]PGDXu et al.Topology Attack and Defense for Graph Neural Networks: An Optimization Perspective,IJCAI'19[Example]MinmaxAttackXu et al.Topology Attack and Defense for Graph Neural Networks: An Optimization Perspective,IJCAI'19[Example]Graph Injection Attack (GIA)MethodsDescriptionsExamplesRandomInjectionA simple random method that chooses nodes to inject randomly.[Example]AdvInjectionThe 2nd place solution ofKDD Cup 2020, team: ADVERSARIES.[Example]Graph Universal Attack (GUA)Graph Backdoor Attack (GBA)MethodsDescriptionsExamplesLGCBackdoorChen et al.Neighboring Backdoor Attacks on Graph Convolutional Network,arXiv'22[Example]FGBackdoorChen et al.Neighboring Backdoor Attacks on Graph Convolutional Network,arXiv'22[Example]Enhancing Techniques or Corresponding DefenseStandard GNNs (without defense)SupervisedMethodsDescriptionsExamplesGCNKipf et al.Semi-Supervised Classification with Graph Convolutional Networks,ICLR'17[Example]SGCWu et al.Simplifying Graph Convolutional Networks,ICLR'19[Example]GATVeličković et al.Graph Attention Networks,ICLR'18[Example]DAGNNLiu et al.Towards Deeper Graph Neural Networks,KDD'20[Example]APPNPKlicpera et al.Predict then Propagate: Graph Neural Networks meet Personalized PageRank,ICLR'19[Example]JKNetXu et al.Representation Learning on Graphs with Jumping Knowledge Networks,ICML'18[Example]TAGCNDu et al.Topological Adaptive Graph Convolutional Networks,arXiv'17[Example]SSGCZhu et al.Simple Spectral Graph Convolution,ICLR'21[Example]DGCWang et al.Dissecting the Diffusion Process in Linear Graph  Convolutional Networks,NeurIPS'21[Example]NLGCN, NLMLP, NLGATLiu et al.Non-Local Graph Neural Networks,TPAMI'22[Example]Unsupervised/Self-superviseMethodsDescriptionsExamplesDGIVeličković et al.Deep Graph Infomax,ICLR'19[Example]Techniques Against Adversarial AttacksMethodsDescriptionsExamplesMedianGCNChen et al.Understanding Structural Vulnerability in Graph Convolutional Networks,IJCAI'21[Example]RobustGCNZhu et al.Robust Graph Convolutional Networks Against Adversarial Attacks,KDD'19[Example]SoftMedianGCNGeisler et al.Reliable Graph Neural Networks via Robust Aggregation,NeurIPS'20Geisler et al.Robustness of Graph Neural Networks at Scale,NeurIPS'21[Example]ElasticGNNLiu et al.Elastic Graph Neural Networks,ICML'21[Example]AirGNNLiu et al.Graph Neural Networks with Adaptive Residual,NeurIPS'21[Example]SimPGCNJin et al.Node Similarity Preserving Graph Convolutional Networks,WSDM'21[Example]SATLi et al.Spectral Adversarial Training for Robust Graph Neural Network,arXiv'22[Example]JaccardPurificationWu et al.Adversarial Examples on Graph Data: Deep Insights into Attack and Defense,IJCAI'19[Example]SVDPurificationEntezari et al.All You Need Is Low (Rank): Defending Against Adversarial Attacks on Graphs,WSDM'20[Example]GNNGUARDZhang et al.GNNGUARD: Defending Graph Neural Networks against Adversarial Attacks,NeurIPS'20[Example]GUARDLi et al.GUARD: Graph Universal Adversarial Defense,arXiv'22[Example]RTGCNWu et al.Robust Tensor Graph Convolutional Networks via T-SVD based Graph Augmentation,KDD'22[Example]More details of literatures and the official codes can be found atAwesome Graph Adversarial Learning.Techniques Against Inherent NoiseMethodsDescriptionsExamplesDropEdgeRong et al.DropEdge: Towards Deep Graph Convolutional Networks on Node Classification,ICLR'20[Example]DropNodeYou et al.Graph Contrastive Learning with Augmentations,NeurIPS'20[Example]DropPathLi et al.MaskGAE: Masked Graph Modeling Meets Graph Autoencoders,arXiv'22'[Example]FeaturePropagationRossi et al.On the Unreasonable Effectiveness of Feature propagation in Learning on Graphs with Missing Node Features,ICLR'21[Example]MiscellaneousMethodsDescriptionsExamplesCentered Kernel Alignment (CKA)Nguyen et al.Do Wide and Deep Networks Learn the Same Things? Uncovering How Neural Network Representations Vary with Width and Depth,ICLR'21[Example]❓ Known IssuesDespite our best efforts, we still had difficulty reproducing the results ofGNNGUARDin the paper. If you find any problems, please don't hesitate to contact me.Untargeted attacksare suffering from performance degradation, as also in DeepRobust, when a validation set is used during training with model picking. Such phenomenon has also been revealed inBlack-box Gradient Attack on Graph Neural Networks: Deeper Insights in Graph-based Attack and Defense.