Skip to content

Instantly share code, notes, and snippets.

View GAT.py
import torch
from torch.nn import Parameter, functional as F
from torch_geometric.nn import MessagePassing
from torch_geometric.nn.inits import glorot, zeros
from torch_geometric.utils import remove_self_loops, add_self_loops, softmax
from torch_geometric.utils.num_nodes import maybe_num_nodes
from torch_scatter import scatter_max, scatter_add
def softmax(src, index, num_nodes=None):
@chnsh
chnsh / Graph.py
Last active Jul 11, 2018
Common Graph algorithms in Python
View Graph.py
from collections import deque
import heapq
import unittest
import warnings
class Graph:
UNDIRECTED = 0
DIRECTED = 1
class Vertex: