### Run OGC Example Source: https://github.com/dmlc/dgl/blob/master/examples/pytorch/ogc/README.md Execute the OGC example script with different datasets. Ensure DGL, PyTorch, and scikit-learn are installed. ```bash python main.py --dataset cora ``` ```bash python main.py --dataset citeseer ``` ```bash python main.py --dataset pubmed ``` -------------------------------- ### Install Dependencies and Set Backend Source: https://github.com/dmlc/dgl/blob/master/examples/tensorflow/gcn/README.md Install TensorFlow and requests, then set the DGL backend to TensorFlow. This is a prerequisite for running the GCN examples. ```bash pip install tensorflow requests export DGLBACKEND=tensorflow ``` -------------------------------- ### Install Dependencies Source: https://github.com/dmlc/dgl/blob/master/examples/pytorch/rgcn-hetero/README.md Installs the necessary libraries for running the RGCN examples. Ensure you have PyTorch 1.0+ installed. ```bash pip install requests torch rdflib pandas ``` -------------------------------- ### Run DGL SEAL Example on CPU Source: https://github.com/dmlc/dgl/blob/master/examples/pytorch/seal/README.md Execute the DGL SEAL example on a CPU. Ensure all dependencies are installed and navigate to the seal_dgl folder before running. ```shell python main.py --gpu_id=-1 --subsample_ratio=0.1 ``` -------------------------------- ### Install Dependencies for SGC Source: https://github.com/dmlc/dgl/blob/master/examples/tensorflow/sgc/README.md Install the necessary libraries for running the SGC example with TensorFlow. ```bash $ pip install dgl tensorflow tensorflow_addons ``` -------------------------------- ### Install DGL and PyTorch Source: https://github.com/dmlc/dgl/blob/master/notebooks/stochastic_training/ondisk_dataset_heterograph.ipynb Installs the necessary DGL library and sets up the PyTorch backend. Ensure you have the correct PyTorch version installed before running. ```python # Install required packages. import os import torch import numpy as np os.environ['TORCH'] = torch.__version__ os.environ['DGLBACKEND'] = "pytorch" # Install the CPU version. device = torch.device("cpu") !pip install --pre dgl -f https://data.dgl.ai/wheels-test/repo.html try: import dgl import dgl.graphbolt as gb installed = True except ImportError as error: installed = False print(error) print("DGL installed!" if installed else "DGL not found!") ``` -------------------------------- ### Run DGL SEAL Example on GPU Source: https://github.com/dmlc/dgl/blob/master/examples/pytorch/seal/README.md Execute the DGL SEAL example on a GPU. Ensure all dependencies are installed and navigate to the seal_dgl folder before running. ```shell python main.py --gpu_id=0 --subsample_ratio=0.1 ``` -------------------------------- ### Run Example with Cora Dataset Source: https://github.com/dmlc/dgl/blob/master/examples/pytorch/hardgat/README.md Execute the training script for the HardGAT model using the Cora dataset. This is the basic command to start the example. ```bash python train.py --dataset=cora ``` -------------------------------- ### Install PyTorch and Requests Source: https://github.com/dmlc/dgl/blob/master/examples/mxnet/appnp/README.md Install the necessary libraries for the project. Ensure you have MXNet 1.5+ installed. ```bash pip install torch requests ``` -------------------------------- ### Install DGL and Dependencies Source: https://github.com/dmlc/dgl/blob/master/notebooks/stochastic_training/ondisk_dataset_homograph.ipynb Installs the DGL library and sets up the PyTorch backend. Ensure you have PyTorch installed before running. ```python import os import torch import numpy as np os.environ['TORCH'] = torch.__version__ os.environ['DGLBACKEND'] = "pytorch" # Install the CPU version. device = torch.device("cpu") !pip install --pre dgl -f https://data.dgl.ai/wheels-test/repo.html try: import dgl import dgl.graphbolt as gb installed = True except ImportError as error: installed = False print(error) print("DGL installed!" if installed else "DGL not found!") ``` -------------------------------- ### Install Dependencies and Set Backend Source: https://github.com/dmlc/dgl/blob/master/examples/tensorflow/gat/README.md Install necessary libraries and set the DGL backend to TensorFlow. Ensure you have tensorflow 2.1.0+ installed. ```bash pip install tensorflow requests DGLBACKEND=tensorflow ``` -------------------------------- ### Run HGP-SL Example (CPU) Source: https://github.com/dmlc/dgl/blob/master/examples/pytorch/hgp_sl/README.md Execute the HGP-SL example on a CPU. Replace ${your_dataset_name_here} with the desired dataset (e.g., DD, PROTEINS). ```bash python main.py --dataset ${your_dataset_name_here} [hyper-parameters] ``` -------------------------------- ### Install Dependencies Source: https://github.com/dmlc/dgl/blob/master/examples/pytorch/graphsage/README.md Installs necessary Python packages for running the GraphSAGE examples. ```bash pip install requests torchmetrics==0.11.4 ogb ``` -------------------------------- ### Run GXN Example Script Source: https://github.com/dmlc/dgl/blob/master/examples/pytorch/gxn/README.md Execute the main GXN example script with specified parameters. Ensure you are in the 'gxn' directory. ```bash bash scripts/run_gxn.sh ${dataset_name} ${device_id} ${num_trials} ${print_trainlog_every} ``` -------------------------------- ### Run HGP-SL Example (GPU) Source: https://github.com/dmlc/dgl/blob/master/examples/pytorch/hgp_sl/README.md Execute the HGP-SL example on a GPU. Specify the device ID and dataset. Adjust hyper-parameters as needed. ```bash python main.py --device ${your_device_id_here} --dataset ${your_dataset_name_here} [hyper-parameters] ``` -------------------------------- ### Installation Requirements Source: https://github.com/dmlc/dgl/blob/master/examples/pytorch/ogb/ngnn_seal/README.md Lists the necessary package versions for running the experiments. Ensure these are installed before proceeding. ```bash ogb>=1.3.4 torch>=1.12.0 dgl>=0.8 scipy, numpy, tqdm... ``` -------------------------------- ### Install Graphbolt and Set Up Environment Source: https://github.com/dmlc/dgl/blob/master/notebooks/graphbolt/walkthrough.ipynb Installs the necessary packages, including DGL with PyTorch backend, and sets up the environment for using Graphbolt. ```python # Install required packages. import os import torch os.environ['TORCH'] = torch.__version__ os.environ['DGLBACKEND'] = "pytorch" # Install the CPU version. device = torch.device("cpu") !pip install --pre dgl -f https://data.dgl.ai/wheels-test/repo.html try: import dgl.graphbolt as gb installed = True except ImportError as error: installed = False print(error) print("DGL installed!" if installed else "DGL not found!") ``` -------------------------------- ### Run PPI Example Source: https://github.com/dmlc/dgl/blob/master/examples/pytorch/geniepath/README.md Execute the Protein-Protein Interaction (PPI) node classification example. ```bash python ppi.py ``` -------------------------------- ### Run GNN-FiLM Example Source: https://github.com/dmlc/dgl/blob/master/examples/pytorch/GNN-FiLM/README.md Execute the main script for the GNN-FiLM example. Use the --gpu flag to enable GPU acceleration. ```bash python main.py ``` ```bash python main.py --gpu ${your_device_id_here} ``` -------------------------------- ### Install Dependencies and Set Backend Source: https://github.com/dmlc/dgl/blob/master/examples/tensorflow/rgcn/README.md Installs necessary Python packages and sets the DGL backend to TensorFlow. Ensure you have Tensorflow 2.2+ installed. ```bash pip install requests tensorflow rdflib pandas export DGLBACKEND=tensorflow ``` -------------------------------- ### Install TensorFlow and Requests Source: https://github.com/dmlc/dgl/blob/master/examples/tensorflow/dgi/README.md Install the necessary libraries for running the DGI experiments. ```bash pip install tensorflow requests ``` -------------------------------- ### Install Python Libraries Source: https://github.com/dmlc/dgl/blob/master/examples/distributed/graphsage/README.md Installs necessary Python libraries for distributed training. ```bash pip3 install ogb ``` -------------------------------- ### Install GluonCV Source: https://github.com/dmlc/dgl/blob/master/examples/mxnet/scenegraph/README.md Install or upgrade the GluonCV library, which is the foundation for this implementation. ```bash pip install gluoncv --upgrade ``` -------------------------------- ### Install Python Libraries Source: https://github.com/dmlc/dgl/blob/master/examples/pytorch/graphsage/dist/README.md Installs necessary Python libraries for distributed training. Requires root privileges. ```bash sudo pip3 install ogb ``` -------------------------------- ### Install Requirements Source: https://github.com/dmlc/dgl/blob/master/examples/mxnet/graphsage/README.md Install the 'requests' library, which is a requirement for this project. ```bash pip install requests ``` -------------------------------- ### Install Dependencies Source: https://github.com/dmlc/dgl/blob/master/examples/pytorch/labor/README.md Install necessary Python packages for the project, including PyTorch Lightning and OGB. ```bash pip install requests lightning==2.0.6 ogb ``` -------------------------------- ### Install Dependencies Source: https://github.com/dmlc/dgl/blob/master/examples/mxnet/gin/README.md Installs necessary Python packages for running GIN experiments. ```bash pip install torch sklearn tqdm ``` -------------------------------- ### Install torchmetrics Source: https://github.com/dmlc/dgl/blob/master/examples/multigpu/README.md Install the torchmetrics library with a specific version, required for certain functionalities. ```bash pip install torchmetrics==0.11.4 ``` -------------------------------- ### Install Airspeed Velocity Source: https://github.com/dmlc/dgl/blob/master/benchmarks/README.md Install the Airspeed Velocity benchmarking tool using pip. ```bash pip install asv ``` -------------------------------- ### Example IP Configuration Source: https://github.com/dmlc/dgl/blob/master/docs/source/guide/distributed-preprocessing.rst An example IP configuration file used by the dispatch_data.py script to specify the cluster's IP addresses. ```bash 172.31.19.1 172.31.23.205 ``` -------------------------------- ### Train GATNE-T on Example Dataset Source: https://github.com/dmlc/dgl/blob/master/examples/pytorch/GATNE-T/README.md Run the main training script for the GATNE-T model using the example dataset. ```bash python src/main.py --input data/example ``` -------------------------------- ### Run Node Classification Example Source: https://github.com/dmlc/dgl/blob/master/examples/pytorch/multigpu/README.md Execute the multi-GPU node classification script. This example uses the 'ogbn-products' dataset by default. ```bash python3 multi_gpu_node_classification.py ``` -------------------------------- ### Run Main Example with GPU Source: https://github.com/dmlc/dgl/blob/master/examples/pytorch/sagpool/README.md Run the main example script on a GPU by specifying the device ID and dataset name. Ensure the specified device ID is valid for your system. ```bash python main.py --device ${your_device_id_here} --dataset ${your_dataset_name_here} ``` -------------------------------- ### Install Requirements for OGB Datasets Source: https://github.com/dmlc/dgl/blob/master/examples/pytorch/ogb/ngnn/README.md Ensure these libraries are installed before running the experiments. Versions specified are recommended. ```bash ogb>=1.3.3 torch>=1.11.0 dgl>=0.8 ``` -------------------------------- ### Install MXNet and Requests Source: https://github.com/dmlc/dgl/blob/master/examples/mxnet/gat/README.md Install the MXNet nightly build and the requests library. Ensure you are using a recent MXNet version for compatibility. ```bash pip install mxnet --pre pip install requests ``` -------------------------------- ### Install Dependencies with Pip Source: https://github.com/dmlc/dgl/blob/master/examples/mxnet/tree_lstm/README.md Installs the necessary dependencies, including MXNet nightly build, requests, and nltk, using pip. ```bash pip install mxnet --pre pip install requests nltk ``` -------------------------------- ### Run Pubmed Example Source: https://github.com/dmlc/dgl/blob/master/examples/pytorch/geniepath/README.md Execute the Pubmed node classification example. Use the --gpu argument to specify a GPU device. ```bash python pubmed.py ``` ```bash python pubmed.py --gpu 0 ``` -------------------------------- ### Import DGL and Check Installation Source: https://github.com/dmlc/dgl/blob/master/notebooks/stochastic_training/multigpu_node_classification.ipynb Imports the DGL library and its graphbolt module, then checks if the installation was successful. This is a standard setup step for using DGL functionalities. ```python try: import dgl import dgl.graphbolt as gb installed = True except ImportError as error: installed = False print(error) print("DGL installed!" if installed else "DGL not found!") ``` -------------------------------- ### Install DGL-Go from Source Source: https://github.com/dmlc/dgl/blob/master/dglgo/README.md Install DGL-Go from its source code to access experimental features. This method requires a local copy of the DGL-Go source. ```bash python setup.py install ``` -------------------------------- ### Prepare Data Directory Source: https://github.com/dmlc/dgl/blob/master/examples/pytorch/GATNE-T/README.md Create a 'data' directory and navigate into it to store datasets. ```bash mkdir data cd data ``` -------------------------------- ### Setup Dependencies with Conda Source: https://github.com/dmlc/dgl/blob/master/examples/pytorch/hilander/README.md Installs necessary packages including PyTorch, CUDA toolkit, DGL, and Faiss-GPU using Conda. It also clones and installs the clustering-benchmark package. ```bash conda create -n Hilander # create env conda activate Hilander # activate env conda install pytorch==1.7.0 torchvision==0.8.0 cudatoolkit=10.2 -c pytorch # install pytorch 1.7 version conda install -y cudatoolkit=10.2 faiss-gpu=1.6.5 -c pytorch # install faiss gpu version matching cuda 10.2 pip install dgl-cu102 dglgo -f https://data.dgl.ai/wheels/repo.html # install the latest dgl for cuda 10.2 pip install tqdm # install tqdm git clone https://github.com/yjxiong/clustering-benchmark.git # install clustering-benchmark for evaluation cd clustering-benchmark python setup.py install cd ../ ``` -------------------------------- ### Validation Output Log Source: https://github.com/dmlc/dgl/blob/master/notebooks/stochastic_training/multigpu_node_classification.ipynb Example output log indicating the start of the validation phase. ```text Validating... ``` -------------------------------- ### Example Command for DD Dataset on GPU Source: https://github.com/dmlc/dgl/blob/master/examples/pytorch/hgp_sl/README.md A concrete example command to run the HGP-SL experiment on the DD dataset using GPU 0. Includes common hyper-parameters. ```bash python main.py --device 0 --dataset DD --lr 0.0001 --batch_size 64 --pool_ratio 0.3 --dropout 0.5 --conv_layers 2 ``` -------------------------------- ### Train GRAND on Cora Dataset Source: https://github.com/dmlc/dgl/blob/master/examples/pytorch/grand/README.md Example command to train the GRAND model on the Cora dataset with specified hyperparameters. Ensure all dependencies are installed and the script is executable. ```bash python main.py --dataname cora --gpu 0 --lam 1.0 --tem 0.5 --order 8 --sample 4 --input_droprate 0.5 --hidden_droprate 0.5 --dropnode_rate 0.5 --hid_dim 32 --early_stopping 100 --lr 1e-2 --epochs 2000 ``` -------------------------------- ### Find PyTorch and Get Version Source: https://github.com/dmlc/dgl/blob/master/tensoradapter/pytorch/CMakeLists.txt Locates the Python interpreter and uses a Python script to find the PyTorch installation prefix and version. This is crucial for setting up the build environment correctly. ```cmake if(NOT PYTHON_INTERP) find_program(PYTHON_INTERP NAMES python3 python) endif() message(STATUS "Using Python interpreter: ${PYTHON_INTERP}") file(TO_NATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/find_cmake.py FIND_CMAKE_PY) execute_process( COMMAND ${PYTHON_INTERP} ${FIND_CMAKE_PY} OUTPUT_VARIABLE TORCH_PREFIX_VER OUTPUT_STRIP_TRAILING_WHITESPACE) message(STATUS "find_cmake.py output: ${TORCH_PREFIX_VER}") list(GET TORCH_PREFIX_VER 0 TORCH_PREFIX) list(GET TORCH_PREFIX_VER 1 TORCH_VER) message(STATUS "Configuring for PyTorch ${TORCH_VER}") ``` -------------------------------- ### Load and Train with Custom Dataset Source: https://github.com/dmlc/dgl/blob/master/docs/source/guide/data-process.rst Instantiate your custom dataset and use DGL's GraphDataLoader for mini-batch training. This example shows the basic setup for iterating through the dataset during training. ```python import dgl import torch from dgl.dataloading import GraphDataLoader # load data dataset = QM7bDataset() num_tasks = dataset.num_tasks # create dataloaders dataloader = GraphDataLoader(dataset, batch_size=1, shuffle=True) # training for epoch in range(100): for g, labels in dataloader: # your training code here pass ``` -------------------------------- ### Run TAHIN Example on Movielens Dataset Source: https://github.com/dmlc/dgl/blob/master/examples/pytorch/TAHIN/readme.md Execute the TAHIN example using the Movielens dataset on a GPU. Ensure the dataset is downloaded and preprocessed as described. ```python python main.py --dataset movielens --gpu 0 ``` -------------------------------- ### Install Dependencies Source: https://github.com/dmlc/dgl/blob/master/examples/pytorch/sign/README.md Installs necessary Python packages for running the SIGN models. Ensure you have pip installed. ```bash pip install requests ogb ``` -------------------------------- ### Install Dependencies Source: https://github.com/dmlc/dgl/blob/master/examples/pytorch/GATNE-T/README.md Install project dependencies using pip. Ensure PyTorch 1.7.0+ is installed separately. ```bash pip install -r requirements.txt ``` -------------------------------- ### Run Main Example with Dataset Source: https://github.com/dmlc/dgl/blob/master/examples/pytorch/sagpool/README.md Execute the main example script by specifying the dataset name. This is the standard way to run the SAGPool implementation for graph classification. ```bash python main.py --dataset ${your_dataset_name_here} ``` -------------------------------- ### Run Grid Search Example Source: https://github.com/dmlc/dgl/blob/master/examples/pytorch/sagpool/README.md Initiate a grid search for hyperparameter tuning. Modify the 'grid_search_config.json' file with desired settings before running. Specify the device and the number of trials. ```bash python grid_search.py --device ${your_device_id_here} --num_trials ${num_of_trials_here} ``` -------------------------------- ### Run Training and Evaluation Source: https://github.com/dmlc/dgl/blob/master/examples/pytorch/capsule/README.md Execute the main script to start training and evaluation. Default configurations are used unless specified. ```bash # Run with default config python3 main.py ``` ```bash # Run with train and test batch size 128, and for 50 epochs python3 main.py --batch-size 128 --test-batch-size 128 --epochs 50 ``` -------------------------------- ### Install DGL and PyTorch Source: https://github.com/dmlc/dgl/blob/master/notebooks/sparse/gcn.ipynb Installs the necessary DGL and PyTorch packages. Ensure your CUDA version is compatible with the DGL installation command. ```python # Install required packages. import os import torch os.environ['TORCH'] = torch.__version__ os.environ['DGLBACKEND'] = "pytorch" # Uncomment below to install required packages. If the CUDA version is not 11.8, # check the https://www.dgl.ai/pages/start.html to find the supported CUDA # version and corresponding command to install DGL. #!pip install dgl -f https://data.dgl.ai/wheels/cu118/repo.html > /dev/null try: import dgl installed = True except ImportError: installed = False print("DGL installed!" if installed else "DGL not found!") ``` -------------------------------- ### Build and Serve Documentation Locally Source: https://github.com/dmlc/dgl/blob/master/docs/source/contribute.rst Steps to build the DGL documentation locally using Sphinx and serve it via a local HTTP server. Ensure you are in the 'docs' directory. ```bash cd docs ./clean.sh make html cd build/html python3 -m http.server 8080 ``` -------------------------------- ### Install DGL and Dependencies Source: https://github.com/dmlc/dgl/blob/master/notebooks/sparse/graph_diffusion.ipynb Installs the DGL library and other required packages. Ensure your CUDA version is compatible or adjust the installation command accordingly. ```python # Install required packages. import os import torch os.environ['TORCH'] = torch.__version__ os.environ['DGLBACKEND'] = "pytorch" # Uncomment below to install required packages. If the CUDA version is not 11.8, # check the https://www.dgl.ai/pages/start.html to find the supported CUDA # version and corresponding command to install DGL. #!pip install dgl -f https://data.dgl.ai/wheels/cu118/repo.html > /dev/null #!pip install --upgrade scipy networkx > /dev/null try: import dgl installed = True except ImportError: installed = False print("DGL installed!" if installed else "Failed to install DGL!") ``` -------------------------------- ### Run Example GNN Program with ARGO Source: https://github.com/dmlc/dgl/blob/master/examples/pytorch/argo/README.md Execute the main example script with specified dataset, sampler, and model configurations. Adjust arguments like layer count, fanout, hidden dimension, and batch size as needed. ```shell python main.py --dataset ogbn-products --sampler shadow --model sage ``` -------------------------------- ### Example Heterogeneous Graph Node File Source: https://github.com/dmlc/dgl/blob/master/docs/source/guide/distributed-partition.rst An example of a node file for a heterogeneous graph with two node types, demonstrating node weights for balancing partitions. ```none 0 1 0 0 0 1 0 1 0 1 0 2 1 0 1 0 1 0 1 1 1 0 1 2 1 0 1 3 ``` -------------------------------- ### Install PCQM4M-LSC Dependencies Source: https://github.com/dmlc/dgl/blob/master/examples/pytorch/ogb_lsc/PCQM4M/README.md Installs necessary packages including ogb, rdkit, and torch. RDKit installation via conda is recommended for compatibility. ```bash ogb>=1.3.0 rdkit>=2019.03.1 torch>=1.7.0 ``` -------------------------------- ### Compile and Install ParMETIS Source: https://github.com/dmlc/dgl/blob/master/docs/source/guide/distributed-partition.rst Compiles and installs ParMETIS using the MPICC compiler and specifies the installation prefix. Ensure MPICC is available in your environment. ```bash make config cc=mpicc prefix=~/local make install ``` -------------------------------- ### Install DGL and Dependencies Source: https://github.com/dmlc/dgl/blob/master/notebooks/sparse/graph_transformer.ipynb Installs the DGL library and other required packages like OGB. Ensure your CUDA version is compatible with the DGL installation command. ```python import os import torch os.environ['TORCH'] = torch.__version__ os.environ['DGLBACKEND'] = "pytorch" # Uncomment below to install required packages. If the CUDA version is not 11.8, # check the https://www.dgl.ai/pages/start.html to find the supported CUDA # version and corresponding command to install DGL. #!pip install dgl -f https://data.dgl.ai/wheels/cu118/repo.html > /dev/null #!pip install ogb >/dev/null try: import dgl installed = True except ImportError: installed = False print("DGL installed!" if installed else "Failed to install DGL!") ``` -------------------------------- ### Compile and Install METIS Source: https://github.com/dmlc/dgl/blob/master/docs/source/guide/distributed-partition.rst Compiles and installs METIS with shared library support and 64-bit integer support. Ensure the installation path is correctly set. ```bash git clone https://github.com/KarypisLab/METIS.git make config shared=1 cc=gcc prefix=~/local i64=1 make install ``` -------------------------------- ### Example Performance Metrics Source: https://github.com/dmlc/dgl/blob/master/examples/pytorch/ogb/ogbn-mag/README.md Displays typical performance metrics obtained from running the task with default parameters over multiple experiments and epochs. ```text Final performance: All runs: Highest Train: 84.67 ± 0.37 Highest Valid: 48.75 ± 0.39 Final Train: 71.08 ± 7.09 Final Test: 47.81 ± 0.37 ``` -------------------------------- ### Run Sampler for Custom Datasets Source: https://github.com/dmlc/dgl/blob/master/examples/pytorch/metapath2vec/README.md Prepare your graph data in the AMiner format and then run the sampler script. This example uses 'net_dbis' as the dataset name. ```bash python sampler.py net_dbis ``` -------------------------------- ### Install DGL-Go Latest Stable Version Source: https://github.com/dmlc/dgl/blob/master/dglgo/README.md Install the latest stable version of DGL-Go using pip. Ensure DGL v0.8+ is installed beforehand. ```bash pip install dglgo ``` -------------------------------- ### Install DGL and PyTorch Source: https://github.com/dmlc/dgl/blob/master/notebooks/stochastic_training/link_prediction.ipynb Installs necessary packages including DGL with a specific PyTorch version and sets the DGL backend to PyTorch. It also checks for successful installation. ```python # Install required packages. import os import torch os.environ['TORCH'] = torch.__version__ os.environ['DGLBACKEND'] = "pytorch" # Install the CPU version in default. If you want to install CUDA version, # please refer to https://www.dgl.ai/pages/start.html and change runtime type # accordingly. device = torch.device("cpu") !pip install --pre dgl -f https://data.dgl.ai/wheels-test/repo.html try: import dgl import dgl.graphbolt as gb installed = True except ImportError as error: installed = False print(error) print("DGL installed!" if installed else "DGL not found!") ``` -------------------------------- ### Install Dependencies for RGCN Source: https://github.com/dmlc/dgl/blob/master/examples/mxnet/rgcn/README.md Installs necessary Python packages including MXNet nightly build, requests, rdflib, and pandas. Ensure you have MXNet installed with the appropriate version. ```bash pip install mxnet --pre pip install requests rdflib pandas ``` -------------------------------- ### Preview Benchmark Results Source: https://github.com/dmlc/dgl/blob/master/benchmarks/README.md Serve the generated static web pages for benchmark results locally. ```bash asv preview ``` -------------------------------- ### Install Dependencies for Directional GSN Source: https://github.com/dmlc/dgl/blob/master/examples/pytorch/ogb/directional_GSN/README.md Installs necessary libraries including PyTorch, tqdm, networkx, graph-tool, OGB, and DGL. Ensure to activate the 'gsn' conda environment before installation. ```bash conda create --name gsn python=3.7 conda activate gsn conda install pytorch==1.11.0 cudatoolkit=10.2 -c pytorch pip install tqdm pip install networkx conda install -c conda-forge graph-tool pip install ogb pip install dgl-cu102 -f https://data.dgl.ai/wheels/repo.html ``` -------------------------------- ### Install DGL and PyTorch Source: https://github.com/dmlc/dgl/blob/master/notebooks/stochastic_training/multigpu_node_classification.ipynb Installs the necessary DGL and PyTorch packages, setting the environment variable for the PyTorch backend. Ensure you have the correct CUDA version installed if using GPU acceleration. ```python # Install required packages. import os import torch os.environ['TORCH'] = torch.__version__ os.environ['DGLBACKEND'] = "pytorch" # Install the CUDA version. If you want to install CPU version, please ``` -------------------------------- ### Run Example with GPU and Citeseer Dataset Source: https://github.com/dmlc/dgl/blob/master/examples/pytorch/hardgat/README.md Train the HardGAT model using a specified GPU and the Citeseer dataset. This command enables GPU acceleration. ```bash python train.py --gpu 0 --dataset=citeseer ``` -------------------------------- ### Run TAHIN Example on Amazon Dataset Source: https://github.com/dmlc/dgl/blob/master/examples/pytorch/TAHIN/readme.md Execute the TAHIN example using the Amazon dataset on a GPU. Ensure the dataset is downloaded and preprocessed as described. ```python python main.py --dataset amazon --gpu 0 ``` -------------------------------- ### Install ogb package Source: https://github.com/dmlc/dgl/blob/master/docs/source/guide/data-loadogb.rst Install the ogb package using pip before proceeding. ```bash pip install ogb ``` -------------------------------- ### Install scikit-learn Dependency Source: https://github.com/dmlc/dgl/blob/master/examples/pytorch/gin/README.md Install the scikit-learn library, a required dependency for the GIN model. ```bash pip install scikit-learn ``` -------------------------------- ### Install NFS Common Package Source: https://github.com/dmlc/dgl/blob/master/examples/distributed/graphsage/README.md Installs the NFS common package on client machines. ```bash sudo apt-get install nfs-common ``` -------------------------------- ### Run GraphWriter-DGL Example Source: https://github.com/dmlc/dgl/blob/master/examples/pytorch/graphwriter/README.md Execute these shell commands to download data, train the model, and test its performance. ```shell # download data sh prepare_data.sh # training sh run.sh # testing sh test.sh ```