Skip to content

Instantly share code, notes, and snippets.

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 July 11, 2018 13:01
Common Graph algorithms in Python
from collections import deque
import heapq
import unittest
import warnings
class Graph:
UNDIRECTED = 0
DIRECTED = 1
class Vertex: