入门教程

常见的代码工具

  • networkx是专门用来进行图计算的。
  • matplotlib可以用来绘制图像的。
  • pytorch geometric 是用来做图神经网络的
  • dgl 是aws的图神经网络库。暂时用不到。

1 数据处理

图数据类型

1
2
3
4
5
6
7
8
9
data.x: Node feature matrix with shape [num_nodes, num_node_features]

data.edge_index: Graph connectivity in COO format with shape [2, num_edges] and type torch.long

data.edge_attr: Edge feature matrix with shape [num_edges, num_edge_features]

data.y: Target to train against (may have arbitrary shape), e.g., node-level targets of shape [num_nodes, *] or graph-level targets of shape [1, *]

data.pos: Node position matrix with shape [num_nodes, num_dimensions]