{"id":1545,"date":"2024-07-26T23:28:30","date_gmt":"2024-07-26T15:28:30","guid":{"rendered":"https:\/\/www.gnn.club\/?p=1545"},"modified":"2024-07-29T19:56:05","modified_gmt":"2024-07-29T11:56:05","slug":"%e5%9b%be%e8%ae%ba","status":"publish","type":"post","link":"http:\/\/www.gnn.club\/?p=1545","title":{"rendered":"\u56fe\u8bba"},"content":{"rendered":"<h1><img decoding=\"async\" src=\"https:\/\/gnnclub-1311496010.cos.ap-beijing.myqcloud.com\/wp-content\/uploads\/2024\/07\/20240729194128504.png\" style=\"height:50px;display:inline\">  Deep Learning Math<\/h1>\n<hr \/>\n<h2>\u56fe\u8bba\uff08graph Theory\uff09<\/h2>\n<p>\u56fe\u8bba\u5728\u6df1\u5ea6\u5b66\u4e60\u4e2d\u7528\u4e8e\u5904\u7406\u548c\u5206\u6790\u7ed3\u6784\u5316\u6570\u636e\u3002\u56fe\u7684\u8868\u793a\u65b9\u5f0f\uff08\u90bb\u63a5\u77e9\u9635\u548c\u90bb\u63a5\u5217\u8868\uff09\u4f7f\u5f97\u6211\u4eec\u80fd\u591f\u6709\u6548\u5730\u7f16\u7801\u590d\u6742\u5173\u7cfb\u548c\u8fde\u63a5\u4fe1\u606f\u3002\u56fe\u7684\u5168\u5c40\u5c5e\u6027\uff0c\u5982\u8fde\u901a\u6027\u548c\u6700\u77ed\u8def\u5f84\uff0c\u5e2e\u52a9\u7406\u89e3\u56fe\u7684\u6574\u4f53\u7ed3\u6784\uff0c\u4f18\u5316\u6a21\u578b\u4e2d\u7684\u8def\u5f84\u89c4\u5212\u548c\u8fde\u901a\u6027\u5206\u6790\u3002<\/p>\n<p>\u8282\u70b9\u7684\u4e2d\u5fc3\u6027\u6307\u6807\uff08\u5ea6\u4e2d\u5fc3\u6027\u3001\u7279\u5f81\u5411\u91cf\u4e2d\u5fc3\u6027\u7b49\uff09\u7528\u4e8e\u8bc6\u522b\u56fe\u4e2d\u5173\u952e\u8282\u70b9\uff0c\u63d0\u9ad8\u56fe\u795e\u7ecf\u7f51\u7edc\uff08GNN\uff09\u6a21\u578b\u7684\u6027\u80fd\u3002\u56fe\u7684\u5411\u91cf\u5316\u65b9\u6cd5\uff08\u8282\u70b9\u548c\u8fb9\u7684\u5d4c\u5165\uff09\u5c06\u56fe\u7684\u7ed3\u6784\u4fe1\u606f\u8f6c\u5316\u4e3a\u53ef\u5904\u7406\u7684\u5411\u91cf\u5f62\u5f0f\uff0c\u4f7f\u5f97\u56fe\u6570\u636e\u80fd\u591f\u88ab\u6df1\u5ea6\u5b66\u4e60\u6a21\u578b\u9ad8\u6548\u5229\u7528\u3002\u8fd9\u4e9b\u6280\u672f\u5728\u793e\u4ea4\u7f51\u7edc\u5206\u6790\u3001\u63a8\u8350\u7cfb\u7edf\u548c\u5206\u5b50\u7ed3\u6784\u9884\u6d4b\u7b49\u5e94\u7528\u4e2d\u53d1\u6325\u4e86\u91cd\u8981\u4f5c\u7528\u3002<\/p>\n<hr \/>\n<h3><img decoding=\"async\" src=\"https:\/\/img.icons8.com\/bubbles\/50\/000000\/checklist.png\" style=\"height:50px;display:inline\"> Agenda<\/h3>\n<hr \/>\n<ul>\n<li>\n<p>\u56fe\u7684\u8868\u793a(Graph Representation)<\/p>\n<ul>\n<li>\u90bb\u63a5\u77e9\u9635(Adjacency Matrix)<\/li>\n<li>\u90bb\u63a5\u5217\u8868(Adjacency List)<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u56fe\u7684\u5168\u5c40\u5c5e\u6027(Global Attributes)<\/p>\n<ul>\n<li>\u8fde\u901a\u6027(Connectivity)<\/li>\n<li>\u76f4\u5f84\u4e0e\u6700\u77ed\u8def\u5f84(Diameter and Shortest Path)<\/li>\n<li>\u8df3\u6570(Hop Count \/ n-hop)<\/li>\n<li>\u540c\u6784\u6027(Isomorphism)<\/li>\n<li>\u5b8c\u5907\u6027(Completeness)<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u56fe\u7684\u8282\u70b9\u8868\u793a(Node Representation)<\/p>\n<ul>\n<li>\u5ea6\u4e2d\u5fc3\u6027(Degree Centrality)<\/li>\n<li>\u7279\u5f81\u5411\u91cf\u4e2d\u5fc3\u6027(Eigenvector Centrality)<\/li>\n<li>\u4e2d\u4ecb\u4e2d\u5fc3\u6027(Betweenness Centrality)<\/li>\n<li>\u63a5\u8fd1\u4e2d\u5fc3\u6027(Closeness Centrality)<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u56fe\u7684\u8fb9\u5c5e\u6027(Edge Attributes)<\/p>\n<\/li>\n<li>\n<p>\u56fe\u7684\u5411\u91cf\u5316(Embedding of the Graph)<\/p>\n<ul>\n<li>\u8282\u70b9\u7684\u5411\u91cf\u5316(Node Embedding)\n<ul>\n<li>Lookup Table<\/li>\n<li>\u968f\u673a\u6e38\u8d70(Random Walk)<\/li>\n<\/ul>\n<\/li>\n<li>\u5168\u5c40\u4fe1\u606f\u7684\u5411\u91cf\u5316(Global Information Embedding)<\/li>\n<li>\u8fb9\u7684\u5411\u91cf\u5316(Edge Embedding)<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h2><img decoding=\"async\" src=\"https:\/\/img.icons8.com\/?size=100&id=zCqLOIcK9Lpw&format=png&color=000000\" style=\"height:50px;display:inline\"> \u56fe\u7684\u8868\u793a<\/h2>\n<hr \/>\n<p>\u9996\u5148\u8ba9\u6211\u4eec\u786e\u5b9a\u4ec0\u4e48\u662f\u56fe\uff0c\u56fe\u4ee3\u8868\u4e86\u4e00\u7ec4\u5b9e\u4f53\uff08\u8282\u70b9\uff09\u4e4b\u95f4\u7684\u5173\u7cfb\uff08\u8fb9\uff09\u3002\u7528\u4e8e\u8868\u793a\u56fe\u7684\u4e3b\u8981\u5c5e\u6027\u6709\u4e09\u4e2a\uff1a<\/p>\n<p>\uff081\uff09Vertex\/Node \u9876\u70b9\uff08\u6216\u8282\u70b9\uff09\u5c5e\u6027\u3002\u4f8b\u5982\uff0c\u8282\u70b9\u7684\u8eab\u4efd\u3001\u90bb\u5c45\u7684\u6570\u91cf\u7b49\u3002<\/p>\n<p>\uff082\uff09Edge\/Link \u8fb9\uff08\u6216\u94fe\u63a5\uff09\u5c5e\u6027\u3002\u4f8b\u5982\uff0c\u8fb9\u7684\u8eab\u4efd\u3001\u8282\u70b9\u7684\u5173\u7cfb\u7b49\u3002<\/p>\n<p>\uff083\uff09Global \u5168\u5c40\uff08\u6216\u4e3b\u8282\u70b9\uff09\u5c5e\u6027\u3002\u4f8b\u5982\uff0c\u8282\u70b9\u7684\u6570\u91cf\u3001\u6700\u957f\u7684\u8def\u5f84\u7b49\uff0c\u8868\u793a\u6574\u5f20\u56fe\u7684\u4e3b\u8981\u7279\u5f81\u3002<\/p>\n<p>\u4e3a\u4e86\u8fdb\u4e00\u6b65\u63cf\u8ff0\u6bcf\u4e2a\u8282\u70b9\u3001\u8fb9\u6216\u6574\u4e2a\u56fe\uff0c\u53ef\u4ee5\u7528\u5411\u91cf\u7684\u5f62\u5f0f\u6765\u5b58\u50a8\u4fe1\u606f\uff0c\u5373\u628a\u70b9\u3001\u8fb9\u548c\u5168\u5c40\u90fd\u7528\u5411\u91cf\u8fdb\u884c\u8868\u793a\uff0c\u5982\u56fe\u6240\u793a\u3002<\/p>\n<p align=\"center\">\n  <img decoding=\"async\" src=\"https:\/\/gnnclub-1311496010.cos.ap-beijing.myqcloud.com\/wp-content\/uploads\/2024\/07\/20240729194454760.png\" style=\"height:300px\">\n<\/p>\n<pre><code class=\"language-python\">import torch\nfrom torch_geometric.data import Data\n\n# \u5b9a\u4e49\u56fe\u7684\u8282\u70b9\u548c\u8fb9\n# x \u662f\u5f62\u72b6\u4e3a [num_nodes, num_node_features] \u7684\u7279\u5f81\u77e9\u9635\nx = torch.tensor([[1, 2], [3, 4], [5, 6]], dtype=torch.float)\n\n# edge_index \u5b9a\u4e49\u4e86\u8282\u70b9\u4e4b\u95f4\u7684\u8fde\u63a5\n# \u5b83\u662f\u4e00\u4e2a\u5f62\u72b6\u4e3a [2, num_edges] \u7684\u4e8c\u7ef4\u5f20\u91cf\nedge_index = torch.tensor([[0, 1, 2, 0],\n                           [1, 0, 1, 2]], dtype=torch.long)\n\n# \u589e\u52a0\u5168\u5c40\u7279\u5f81\n# u \u662f\u5f62\u72b6\u4e3a [num_graphs, num_global_features] \u7684\u5f20\u91cf\nu = torch.tensor([[1, 2, 3]], dtype=torch.float)\n\n# \u521b\u5efa Data \u5bf9\u8c61\ndata = Data(x=x, edge_index=edge_index, u=u)\n\nprint(data)\n\n# \u8f93\u51fa\u56fe\u7684\u5c5e\u6027\nprint(&quot;\u7279\u5f81\u77e9\u9635 (x):&quot;)\nprint(data.x)\nprint(&quot;\u8fb9\u7d22\u5f15 (edge_index):&quot;)\nprint(data.edge_index)\nprint(&quot;\u5168\u5c40\u7279\u5f81 (u):&quot;)\nprint(data.u)\n<\/code><\/pre>\n<pre><code>    Data(x=[3, 2], edge_index=[2, 4], u=[1, 3])\n    \u7279\u5f81\u77e9\u9635 (x):\n    tensor([[1., 2.],\n            [3., 4.],\n            [5., 6.]])\n    \u8fb9\u7d22\u5f15 (edge_index):\n    tensor([[0, 1, 2, 0],\n            [1, 0, 1, 2]])\n    \u5168\u5c40\u7279\u5f81 (u):\n    tensor([[1., 2., 3.]])<\/code><\/pre>\n<h2>\u90bb\u63a5\u77e9\u9635\/\u5217\u8868\uff08Adjacency Matrix\/List\uff09<\/h2>\n<p>\u90bb\u63a5\u77e9\u9635 (Adjacency Matrix) \u662f\u8868\u793a\u9876\u70b9\u4e4b\u95f4\u76f8\u90bb\u5173\u7cfb\u7684\u77e9\u9635, \u5982\u56fe\u6240\u793a\u3002\u8bbe $G=(V, E)$ \u662f\u4e00\u4e2a\u56fe, \u5176\u4e2d  $V=\\lbrace{v_1, v_2, \\cdots, v_n\\rbrace}$  \u3002 $G$ \u7684\u90bb\u63a5\u77e9\u9635\u662f\u4e00\u4e2a $n$ \u9636\u65b9\u9635\u4e14\u5177\u6709\u4ee5\u4e0b\u6027\u8d28\u3002<\/p>\n<p>(1) \u5bf9\u65e0\u5411\u56fe\u800c\u8a00, \u90bb\u63a5\u77e9\u9635\u4e00\u5b9a\u662f\u5bf9\u79f0\u7684, \u6709\u5411\u56fe\u5219\u4e0d\u4e00\u5b9a\u5982\u6b64\u3002<\/p>\n<p>(2) \u5728\u65e0\u5411\u56fe\u4e2d, \u4efb\u4e00\u9876\u70b9 $i$ \u7684\u5ea6\u4e3a\u7b2c $i$ \u5217\uff08\u6216\u7b2c $i$ \u884c\uff09\u6240\u6709\u975e\u96f6\u5143\u7d20\u7684\u4e2a\u6570, \u5728\u6709\u5411\u56fe\u4e2d\u9876\u70b9 $i$ \u7684\u51fa\u5ea6\u4e3a\u7b2c $i$ \u884c\u6240\u6709\u975e\u96f6\u5143\u7d20\u7684\u4e2a\u6570, \u800c\u5165\u5ea6\u4e3a\u7b2c $i$ \u5217\u6240\u6709\u975e\u96f6\u5143\u7d20\u7684\u4e2a\u6570\u3002<\/p>\n<p>(3) \u7528\u90bb\u63a5\u77e9\u9635\u6cd5\u8868\u793a\u56fe\u5171\u9700\u8981 $n^2$ \u4e2a\u7a7a\u95f4, \u7531\u4e8e\u65e0\u5411\u56fe\u7684\u90bb\u63a5\u77e9\u9635\u4e00\u5b9a\u5177\u6709\u5bf9\u79f0\u5173\u7cfb,\u6240\u4ee5\u6263\u9664\u5bf9\u89d2\u7ebf\u4e3a\u96f6\u5916, \u4ec5\u9700\u8981\u5b58\u50a8\u4e0a\u4e09\u89d2\u5f62\u6216\u4e0b\u4e09\u89d2\u5f62\u7684\u6570\u636e\u5373\u53ef, \u56e0\u6b64\u4ec5\u9700\u8981 $n(n-1) \/ 2$\u4e2a\u7a7a\u95f4\u3002\u5373\u4fbf\u5982\u6b64, \u5f53\u56fe\u7ed3\u6784\u592a\u5927\u65f6, \u90bb\u63a5\u77e9\u9635\u5b58\u50a8\u7684\u8d44\u6e90\u5360\u7528\u4f9d\u7136\u662f\u4e00\u4e2a\u95ee\u9898\u3002<\/p>\n<p align=\"center\">\n  <img decoding=\"async\" src=\"https:\/\/gnnclub-1311496010.cos.ap-beijing.myqcloud.com\/wp-content\/uploads\/2024\/07\/20240729194521690.png\" style=\"height:300px\">\n<\/p>\n<p>\u6b64\u5916\uff0c\u9664\u4e86\u4f7f\u75280\u30011\u6765\u8868\u793a\u8282\u70b9\u4e4b\u95f4\u662f\u5426\u5b58\u5728\u5173\u7cfb\u4ee5\u5916\uff0c\u4e5f\u53ef\u4ee5\u7528\u6743\u91cd\u7684\u65b9\u6cd5\u8fdb\u884c\u8282\u70b9\u5173\u7cfb\u7684\u8868\u793a\uff0c\u5982\u679c\u5173\u7cfb\u5f3a\uff0c\u5219\u8d4b\u4e88\u66f4\u9ad8\u7684\u6570\u503c\uff0c\u53cd\u4e4b\u4ea6\u7136\u3002\u5982\u4e0b\u56fe\u6240\u793a\uff0c\u5468\u745c\u548c\u5c0f\u4e54\u662f\u592b\u59bb\uff0c\u6240\u4ee5\u53ef\u4ee5\u62e5\u6709\u66f4\u9ad8\u7684\u6743\u91cd\u3002<\/p>\n<p align=\"center\">\n  <img decoding=\"async\" src=\"https:\/\/gnnclub-1311496010.cos.ap-beijing.myqcloud.com\/wp-content\/uploads\/2024\/07\/20240729194546423.png\" style=\"height:300px\">\n<\/p>\n<p>\u8868\u793a\u7a00\u758f\u77e9\u9635\u7684\u4e00\u79cd\u4f18\u96c5\u800c\u6709\u6548\u7684\u8bb0\u5fc6\u65b9\u5f0f\u662f\u90bb\u63a5\u5217\u8868\uff08adjacency list\uff09\u3002\u4f8b\u5982, \u5982\u679c\u8282\u70b9 $n_i$ \u548c $n_j$ \u4e4b\u95f4\u7684\u8fb9 $e_k$ \u5b58\u5728\u8fde\u901a\u6027, \u90a3\u4e48\u628a\u5143\u7ec4 $(i, j)$ \u4f5c\u4e3a\u90bb\u63a5\u5217\u8868\u7684\u7b2c $k$ \u4e2a\u6761\u76ee\u3002\u8fd9\u6837\u53ef\u4ee5\u907f\u514d\u5728\u56fe\u7684\u4e0d\u8fde\u63a5\u90e8\u5206\u8fdb\u884c\u8ba1\u7b97\u548c\u5b58\u50a8\u65e0\u6548\u4fe1\u606f\u3002\u4e3a\u4e86\u4f7f\u8fd9\u4e00\u6982\u5ff5\u5177\u4f53\u5316, \u8bf7\u8bfb\u8005\u89c2\u5bdf\u90bb\u63a5\u5217\u8868\u7684\u8868\u793a\u793a\u4f8b, \u5982\u4e0b\u56fe\u6240\u793a\u3002<\/p>\n<p align=\"center\">\n  <img decoding=\"async\" src=\"https:\/\/gnnclub-1311496010.cos.ap-beijing.myqcloud.com\/wp-content\/uploads\/2024\/07\/20240729194611264.png\" style=\"height:300px\">\n<\/p>\n<h2><img decoding=\"async\" src=\"https:\/\/img.icons8.com\/?size=100&id=DfraGfozBS5c&format=png&color=000000\" style=\"height:50px;display:inline\"> \u56fe\u7684\u5168\u5c40\u5c5e\u6027<\/h2>\n<hr \/>\n<h3>\u6709\u5411\u56fe\u548c\u65e0\u5411\u56fe(Directed\/Undirected\uff09<\/h3>\n<p>\u4e3a\u4e86\u66f4\u6e05\u6670\u7684\u89e3\u91ca\u56fe\u6570\u636e\u7684\u5404\u4e2a\u5c5e\u6027\uff0c\u4ee5\u4e09\u56fd\u65f6\u671f\u7684\u4eba\u7269\u5173\u7cfb\u4e3a\u4f8b\u5b50\u8fdb\u884c\u8bf4\u660e\u3002\u6839\u636e\u56fe\u7ed3\u6784\u4e2d\u7684\u8fb9\u662f\u5426\u6709\u65b9\u5411\uff0c\u53ef\u4ee5\u628a\u56fe\u6570\u636e\u5206\u6210\u4e24\u7c7b\u3002\u8fb9\u6ca1\u6709\u65b9\u5411\u7684\u56fe\u79f0\u4e3a\u65e0\u5411\u56fe\uff1b\u53cd\u4e4b\u5219\u4e3a\u6709\u5411\u56fe\u3002<\/p>\n<p align=\"center\">\n  <img decoding=\"async\" src=\"https:\/\/gnnclub-1311496010.cos.ap-beijing.myqcloud.com\/wp-content\/uploads\/2024\/07\/20240729194640278.png\" style=\"height:300px\">\n<\/p>\n<h3>\u56fe\u7684\u8fde\u901a\u6027\uff08Connectivity of Graphs\uff09<\/h3>\n<p>\u5728\u56fe\u8bba\u4e2d, \u8fde\u901a\u56fe\u57fa\u4e8e\u8fde\u901a\u7684\u6982\u5ff5\u3002\u5728\u4e00\u4e2a\u65e0\u5411\u56fe $G$ \u4e2d, \u82e5\u4ece\u9876\u70b9 $i$ \u5230\u9876\u70b9 $j$ \u6709\u8def\u5f84\u76f8\u8fde (\u5f53\u7136\u4ece $j$ \u5230 $i$ \u4e5f\u4e00\u5b9a\u6709\u8def\u5f84), \u5219\u79f0 $i$ \u548c $j$ \u662f\u8fde\u901a\u7684\u3002\u5982\u679c $G$ \u662f\u6709\u5411\u56fe, \u90a3\u4e48\u8fde\u63a5 $i$ \u548c $j$ \u7684\u8def\u5f84\u4e2d\u6240\u6709\u7684\u8fb9\u90fd\u5fc5\u987b\u540c\u5411\u3002\u5982\u679c\u56fe\u4e2d\u4efb\u610f\u4e24\u70b9\u90fd\u662f\u8fde\u901a\u7684, \u90a3\u4e48\u56fe\u88ab\u79f0\u4f5c\u8fde\u901a\u56fe; \u5982\u679c\u6b64\u56fe\u662f\u6709\u5411\u56fe, \u5219\u79f0\u4e3a\u5f3a\u8fde\u901a\u56fe\u3002<\/p>\n<p align=\"center\">\n  <img decoding=\"async\" src=\"https:\/\/gnnclub-1311496010.cos.ap-beijing.myqcloud.com\/wp-content\/uploads\/2024\/07\/20240729194721115.png\" style=\"height:500px\">\n<\/p>\n<h3>\u56fe\u7684\u76f4\u5f84\u548c\u6700\u77ed\u8def\u5f84(Diameter and Shortest Path)<\/h3>\n<p>\u56fe\u4e2d\u4efb\u610f\u4e24\u8282\u70b9\u7684\u76f8\u8fde\u65b9\u5f0f\u6709\u5f88\u591a\uff0c\u53ef\u80fd\u76f4\u63a5\u76f8\u8fde\uff0c\u4e5f\u53ef\u80fd\u901a\u8fc7\u5176\u5b83\u8282\u70b9\u95f4\u63a5\u76f8\u8fde\u3002\u800c\u56fe\u7684\u6700\u77ed\u8def\u5f84\uff08Shortest Path\uff09\u6307\u7684\u662f\u6240\u4ee5\u8fde\u63a5\u65b9\u5f0f\u4e2d\uff0c\u6700\u77ed\u7684\u90a3\u79cd\u65b9\u5f0f\u3002\u56fe\u7684\u76f4\u5f84\uff08Graph Diameter\uff09\u5b9a\u4e49\u4e3a\u56fe\u4e2d\u6700\u957f\u7684\u6700\u77ed\u8def\u5f84\u7684\u957f\u5ea6\u3002<\/p>\n<p align=\"center\">\n  <img decoding=\"async\" src=\"https:\/\/gnnclub-1311496010.cos.ap-beijing.myqcloud.com\/wp-content\/uploads\/2024\/07\/20240729194747576.png\" style=\"height:300px\">\n<\/p>\n<p>\u5982\u56fe\u6240\u793a\uff0c\u5218\u5907\u548c\u5173\u7fbd\u4e24\u8282\u70b9\u4e4b\u95f4\u53ef\u4ee5\u76f4\u63a5\u76f8\u8fde\uff0c\u4e5f\u53ef\u4ee5\u901a\u8fc7\u5f20\u98de\u76f8\u8fde\u3002\u6b64\u56fe\u7684\u6700\u77ed\u8def\u5f84\u6709\u4e09\u4e2a\uff0c\u5206\u522b\u662f\u5f20\u98de\u2013&gt;\u5173\u7fbd\uff0c\u5173\u7fbd\u2013&gt;\u5218\u5907\uff0c\u5218\u5907\u2013&gt;\u5f20\u98de\uff0c\u800c\u56fe\u7684\u76f4\u5f84\u662f\u5218\u5907\u2013&gt;\u9ec4\u5fe0\u3002<\/p>\n<h3>\u56fe\u7684\u8df3\u6570\uff08n-hop\uff09<\/h3>\n<p>\u5728\u56fe\u8bba\u4e2d\uff0c\u8df3\u6570\uff08Hop Count\uff09\u6307\u7684\u662f\u4e24\u4e2a\u8282\u70b9\u4e4b\u95f4\u7684\u6700\u77ed\u8def\u5f84\u4e2d\u7684\u8fb9\u7684\u6570\u91cf\u3002\u6362\u53e5\u8bdd\u8bf4\uff0c\u8df3\u6570\u662f\u6307\u4ece\u4e00\u4e2a\u8282\u70b9\u5230\u53e6\u4e00\u4e2a\u8282\u70b9\u9700\u8981\u7ecf\u8fc7\u591a\u5c11\u6761\u8fb9\u3002<\/p>\n<p>\u8df3\u6570\u7684\u8ba1\u7b97\u65b9\u6cd5<\/p>\n<p>\u76f4\u63a5\u76f8\u90bb\uff081\u8df3\uff09\uff1a\u5982\u679c\u4e24\u4e2a\u8282\u70b9\u4e4b\u95f4\u76f4\u63a5\u76f8\u8fde\uff0c\u5219\u8df3\u6570\u4e3a1\u3002<\/p>\n<p>\u95f4\u63a5\u76f8\u8fde\uff08n\u8df3\uff09\uff1a\u5982\u679c\u4e24\u4e2a\u8282\u70b9\u4e4b\u95f4\u6ca1\u6709\u76f4\u63a5\u8fde\u63a5\uff0c\u4f46\u901a\u8fc7\u5176\u4ed6\u8282\u70b9\u76f8\u8fde\uff0c\u5219\u8df3\u6570\u4e3a\u4e2d\u95f4\u8282\u70b9\u7684\u6570\u91cf\u52a01\u3002<\/p>\n<p><strong>\u516d\u5ea6\u7a7a\u95f4\u7406\u8bba<\/strong>\uff08Six Degrees of Separation\uff09 \u7406\u8bba\u6307\u51fa\uff1a\u4f60\u548c\u4efb\u4f55\u4e00\u4e2a\u964c\u751f\u4eba\u4e4b\u95f4\u6240\u95f4\u9694\u7684\u4eba\u4e0d\u4f1a\u8d85\u8fc7\u516d\u4e2a\uff086-hop\uff09\uff0c\u4e5f\u5c31\u662f\u8bf4\uff0c\u6700\u591a\u901a\u8fc76\u4e2a\u4e2d\u95f4\u4eba\u4f60\u5c31\u80fd\u591f\u8ba4\u8bc6\u4efb\u4f55\u4e00\u4e2a\u964c\u751f\u4eba\u3002<\/p>\n<h3>\u540c\u6784\u6027\uff08Graph Isomorphism\uff09<\/h3>\n<p>\u56fe\u540c\u6784\u6307\u7684\u662f\u4e24\u4e2a\u56fe\u5728\u672c\u8d28\u4e0a\u662f\u76f8\u540c\u7684\uff0c\u5373\u5b83\u4eec\u7684\u7ed3\u6784\u53ef\u4ee5\u901a\u8fc7\u91cd\u65b0\u6807\u8bb0\u9876\u70b9\u4f7f\u5f97\u4e00\u4e2a\u56fe\u8f6c\u6362\u6210\u53e6\u4e00\u4e2a\u56fe\u3002\u7ed9\u5b9a\u4e24\u4e2a\u56fe $G=\\left(V_G, E_G\\right)$ \u548c $H=\\left(V_H, E_H\\right)$ \uff0c\u6211\u4eec\u8bf4 $G$ \u548c $H$ \u662f\u540c\u6784\u7684\uff0c\u5982\u679c\u5b58\u5728\u4e00\u4e2a\u53cc\u5c04\u51fd\u6570 $f: V_G \\rightarrow V_H$ \uff0c\u4f7f\u5f97\u5bf9\u4e8e\u6240\u6709\u7684\u8fb9 $(u, v) \\in E_G$ \uff0c\u90fd\u6709 $(f(u), f(v)) \\in E_H$ \u3002\u8fd9\u610f\u5473\u7740\uff0c\u540c\u6784\u7684\u4e24\u4e2a\u56fe\u5728\u7ed3\u6784\u4e0a\u662f\u5b8c\u5168\u76f8\u540c\u7684\uff0c\u53ea\u662f\u9876\u70b9\u7684\u6807\u7b7e\u53ef\u80fd\u4e0d\u540c\u3002<\/p>\n<p>\u540c\u6784\u6027\u7684\u5feb\u901f\u7b5b\u67e5<\/p>\n<ol>\n<li>\u9876\u70b9\u6570\u548c\u8fb9\u6570\u7684\u6bd4\u8f83\uff1a<\/li>\n<\/ol>\n<p>\u9996\u5148\u68c0\u67e5\u4e24\u4e2a\u56fe\u7684\u9876\u70b9\u6570\u548c\u8fb9\u6570\u662f\u5426\u76f8\u540c\u3002\u5982\u679c\u4e0d\u540c\uff0c\u4e24\u4e2a\u56fe\u4e0d\u53ef\u80fd\u662f\u540c\u6784\u7684\u3002<\/p>\n<ol start=\"2\">\n<li>\u90bb\u63a5\u77e9\u9635\u7684\u6bd4\u8f83\uff1a<\/li>\n<\/ol>\n<p>\u751f\u6210\u4e24\u4e2a\u56fe\u7684\u90bb\u63a5\u77e9\u9635\uff0c\u5e76\u5c1d\u8bd5\u901a\u8fc7\u884c\u548c\u5217\u7684\u91cd\u65b0\u6392\u5217\u6765\u5339\u914d\u4e24\u4e2a\u90bb\u63a5\u77e9\u9635\u3002\u5982\u679c\u80fd\u591f\u627e\u5230\u4e00\u79cd\u6392\u5217\u65b9\u5f0f\u4f7f\u5f97\u4e24\u4e2a\u90bb\u63a5\u77e9\u9635\u76f8\u540c\uff0c\u90a3\u4e48\u8fd9\u4e24\u4e2a\u56fe\u662f\u540c\u6784\u7684\u3002<\/p>\n<p>\u6ce8\u610f\uff0c\u8fd9\u4e9b\u68c0\u67e5\u65b9\u6cd5\u53ef\u4ee5\u5e2e\u52a9\u5feb\u901f\u6392\u9664\u660e\u663e\u975e\u540c\u6784\u7684\u56fe\u3002\u4f46\u662f\uff0c\u7531\u4e8e\u56fe\u7ed3\u6784\u7684\u590d\u6742\u6027\uff0c\u7279\u522b\u662f\u5927\u89c4\u6a21\u56fe\uff0c\u8fd9\u4e9b\u7279\u5f81\u65e0\u6cd5\u5b8c\u5168\u63cf\u8ff0\u56fe\u7684\u6240\u6709\u7ec6\u8282\u3002\u56e0\u6b64\uff0c\u4ec5\u4f9d\u9760\u8fd9\u4e9b\u65b9\u6cd5\u65e0\u6cd5\u767e\u5206\u4e4b\u767e\u786e\u4fdd\u4e24\u4e2a\u56fe\u7684\u540c\u6784\u6027\u3002<\/p>\n<p>\u56fe\u540c\u6784\u95ee\u9898\u662f\u8ba1\u7b97\u673a\u79d1\u5b66\u4e2d\u4e00\u4e2a\u7ecf\u5178\u7684\u6311\u6218\u3002\u867d\u7136\u6709\u8bb8\u591a\u7b97\u6cd5\u53ef\u4ee5\u7528\u4e8e\u56fe\u540c\u6784\u6027\u68c0\u67e5\uff08VF2 \u7b97\u6cd5\uff0cUllmann \u7b97\u6cd5\uff0cNauty\uff0cWeisfeiler-Lehman Test\u7b49\u7b49\uff09\uff0c\u4f46\u76ee\u524d\u6ca1\u6709\u5df2\u77e5\u7684\u7b97\u6cd5\u53ef\u4ee5\u767e\u5206\u767e\u5730\u89e3\u51b3\u6240\u6709\u60c5\u51b5\u4e0b\u7684\u56fe\u540c\u6784\u95ee\u9898\u3002<\/p>\n<h3>\u5b8c\u5907\u6027\uff08Completeness\uff09<\/h3>\n<p>\u56fe\u7684\u5b8c\u5907\u6027\u662f\u6307\u56fe\u5728\u67d0\u4e9b\u7279\u5b9a\u6761\u4ef6\u4e0b\u662f\u5426\u80fd\u591f\u5145\u5206\u8868\u8fbe\u67d0\u79cd\u4fe1\u606f\u3002\u53ef\u4ee5\u4ece\u5c40\u90e8\u5b8c\u5907\u6027\u548c\u5168\u5c40\u5b8c\u5907\u6027\u4e24\u65b9\u9762\u8fdb\u884c\u8ba8\u8bba\u3002<\/p>\n<p>\u5c40\u90e8\u5b8c\u5907\u6027\uff08Local Completeness\uff09\u662f\u6307\u56fe\u4e2d\u7684\u6bcf\u4e2a\u5b50\u56fe\uff08\u5c40\u90e8\u7ed3\u6784\uff09\u662f\u5426\u80fd\u591f\u5b8c\u5168\u6355\u6349\u5230\u4e0e\u8be5\u5b50\u56fe\u76f8\u5173\u7684\u4fe1\u606f\u3002\u5728\u56fe\u795e\u7ecf\u7f51\u7edc\uff08GNN\uff09\u4e2d\uff0c\u5c40\u90e8\u5b8c\u5907\u6027\u610f\u5473\u7740\u6bcf\u4e2a\u8282\u70b9\u53ca\u5176\u90bb\u5c45\u8282\u70b9\u7684\u4fe1\u606f\u5728\u8282\u70b9\u7684\u8868\u793a\u5b66\u4e60\u4e2d\u662f\u5426\u88ab\u5145\u5206\u5229\u7528\u3002\u5c40\u90e8\u5b8c\u5907\u6027\u7684\u5b9e\u73b0\u5bf9GNN\u6709\u4ee5\u4e0b\u5f71\u54cd\uff1a<\/p>\n<ul>\n<li>\u8282\u70b9\u8868\u793a\u7684\u51c6\u786e\u6027\uff1a\u5982\u679c\u56fe\u5728\u5c40\u90e8\u662f\u5b8c\u5907\u7684\uff0cGNN\u53ef\u4ee5\u66f4\u51c6\u786e\u5730\u6355\u6349\u6bcf\u4e2a\u8282\u70b9\u53ca\u5176\u5c40\u90e8\u90bb\u57df\u7684\u4fe1\u606f\uff0c\u4ece\u800c\u63d0\u9ad8\u8282\u70b9\u8868\u793a\u7684\u51c6\u786e\u6027\u3002<\/li>\n<li>\u4fe1\u606f\u4f20\u64ad\u7684\u6709\u6548\u6027\uff1a\u5c40\u90e8\u5b8c\u5907\u6027\u786e\u4fdd\u4fe1\u606f\u5728\u5c40\u90e8\u7ed3\u6784\u5185\u6709\u6548\u4f20\u64ad\uff0c\u4f7f\u5f97\u6bcf\u4e2a\u8282\u70b9\u80fd\u4ece\u5176\u90bb\u5c45\u8282\u70b9\u4e2d\u83b7\u53d6\u5230\u5b8c\u6574\u7684\u4fe1\u606f\uff0c\u8fd9\u5bf9\u4fe1\u606f\u805a\u5408\u548c\u66f4\u65b0\u8fc7\u7a0b\u975e\u5e38\u91cd\u8981\u3002<\/li>\n<li>\u9c81\u68d2\u6027\uff1a\u5728\u5c40\u90e8\u5b8c\u5907\u7684\u56fe\u4e2d\uff0c\u8282\u70b9\u8868\u793a\u5bf9\u5c40\u90e8\u6270\u52a8\uff08\u5982\u67d0\u4e9b\u8282\u70b9\u6216\u8fb9\u7684\u4e22\u5931\uff09\u5177\u6709\u66f4\u5f3a\u7684\u9c81\u68d2\u6027\uff0c\u56e0\u4e3a\u6bcf\u4e2a\u8282\u70b9\u7684\u8868\u793a\u80fd\u591f\u4f9d\u8d56\u4e8e\u5176\u591a\u4e2a\u90bb\u5c45\u7684\u4fe1\u606f\u3002<\/li>\n<\/ul>\n<p>\u5168\u5c40\u5b8c\u5907\u6027\uff08Global Completeness\uff09\u662f\u6307\u6574\u4e2a\u56fe\u5728\u5168\u5c40\u8303\u56f4\u5185\u662f\u5426\u80fd\u591f\u5b8c\u5168\u8868\u8fbe\u56fe\u7684\u7ed3\u6784\u4fe1\u606f\u3002\u5728GNN\u4e2d\uff0c\u5168\u5c40\u5b8c\u5907\u6027\u610f\u5473\u7740\u6574\u4e2a\u56fe\u7684\u7ed3\u6784\u4fe1\u606f\u5728\u7f51\u7edc\u8bad\u7ec3\u548c\u63a8\u7406\u8fc7\u7a0b\u4e2d\u662f\u5426\u88ab\u5145\u5206\u5229\u7528\u3002\u5168\u5c40\u5b8c\u5907\u6027\u7684\u5b9e\u73b0\u5bf9GNN\u6709\u4ee5\u4e0b\u5f71\u54cd\uff1a<\/p>\n<ul>\n<li>\u56fe\u7ea7\u4efb\u52a1\u7684\u6027\u80fd\uff1a\u5bf9\u4e8e\u56fe\u5206\u7c7b\u6216\u56fe\u56de\u5f52\u7b49\u4efb\u52a1\uff0c\u5168\u5c40\u5b8c\u5907\u6027\u786e\u4fddGNN\u80fd\u591f\u6355\u6349\u5230\u6574\u4e2a\u56fe\u7684\u7ed3\u6784\u4fe1\u606f\uff0c\u4ece\u800c\u63d0\u9ad8\u6a21\u578b\u5728\u56fe\u7ea7\u4efb\u52a1\u4e2d\u7684\u6027\u80fd\u3002<\/li>\n<li>\u5168\u5c40\u4fe1\u606f\u7684\u4f20\u64ad\uff1a\u5168\u5c40\u5b8c\u5907\u6027\u786e\u4fdd\u5168\u5c40\u4fe1\u606f\u80fd\u591f\u5728\u6574\u4e2a\u56fe\u4e2d\u6709\u6548\u4f20\u64ad\uff0c\u4f7f\u5f97\u8fdc\u8ddd\u79bb\u8282\u70b9\u4e4b\u95f4\u7684\u4fe1\u606f\u80fd\u591f\u4e92\u76f8\u5f71\u54cd\uff0c\u4ece\u800c\u63d0\u5347GNN\u5bf9\u5168\u5c40\u4f9d\u8d56\u5173\u7cfb\u7684\u5efa\u6a21\u80fd\u529b\u3002<\/li>\n<li>\u8868\u8fbe\u80fd\u529b\uff1a\u5168\u5c40\u5b8c\u5907\u7684\u56fe\u80fd\u591f\u66f4\u597d\u5730\u8868\u793a\u590d\u6742\u7684\u5168\u5c40\u7ed3\u6784\uff0c\u63d0\u9ad8GNN\u5728\u5904\u7406\u590d\u6742\u56fe\u7ed3\u6784\u65f6\u7684\u8868\u73b0\u3002<\/li>\n<\/ul>\n<p>\u5b8c\u5907\u6027\u4e5f\u53ef\u4ee5\u653e\u5230\u5177\u4f53\u7684\u573a\u666f\u4e0b\u8fdb\u884c\u8ba8\u8bba\uff0c\u4f8b\u5982\uff1a\u5927\u5bb6\u90fd\u77e5\u9053 \u201c\u4e24\u70b9\u786e\u5b9a\u4e00\u7ebf\uff0c\u4e09\u70b9\u786e\u5b9a\u4e00\u5e73\u9762\u201d\uff0c\u90a3\u4e48\u591a\u5c11\u4e2a\u53d8\u91cf\u53ef\u4ee5\u786e\u5b9a\u4e00\u4e2a\u5206\u5b50\u56fe\u5462\uff1f<\/p>\n<p>\u5728\u5316\u5b66\u4e2d\uff0c\u4e00\u4e2a\u5206\u5b50\u7531\u539f\u5b50\u53ca\u5176\u8fde\u63a5\u5173\u7cfb\uff08\u952e\uff09\u786e\u5b9a\u3002\u5177\u4f53\u6765\u8bf4\uff0c\u786e\u5b9a\u4e00\u4e2a\u5206\u5b50\u901a\u5e38\u9700\u8981\u4ee5\u4e0b\u4fe1\u606f\uff1a<\/p>\n<ul>\n<li>\u539f\u5b50\u7684\u79cd\u7c7b\u548c\u6570\u91cf\uff1a\u5206\u5b50\u4e2d\u6709\u591a\u5c11\u79cd\u7c7b\u7684\u539f\u5b50\uff0c\u6bcf\u79cd\u539f\u5b50\u7684\u6570\u91cf\u662f\u591a\u5c11\u3002<\/li>\n<li>\u539f\u5b50\u95f4\u7684\u8fde\u63a5\u65b9\u5f0f\uff1a\u54ea\u4e9b\u539f\u5b50\u4e4b\u95f4\u5b58\u5728\u5316\u5b66\u952e\uff0c\u4ee5\u53ca\u8fd9\u4e9b\u5316\u5b66\u952e\u7684\u7c7b\u578b\uff08\u5355\u952e\u3001\u53cc\u952e\u7b49\uff09\u3002<\/li>\n<li>\u7a7a\u95f4\u7ed3\u6784\uff1a\u539f\u5b50\uff0c\u7535\u5b50\u7b49\u5728\u4e09\u7ef4\u7a7a\u95f4\u4e2d\u7684\u6392\u5e03\u548c\u76f8\u5bf9\u4f4d\u7f6e\u3002<\/li>\n<\/ul>\n<p>\u8fd9\u4e9b\u4fe1\u606f\u5171\u540c\u51b3\u5b9a\u4e86\u4e00\u4e2a\u5206\u5b50\u7684\u7ed3\u6784\u548c\u6027\u8d28\u3002\u53ef\u4ee5\u7c7b\u6bd4\u5730\u8bf4\uff0c\u8fd9\u4e9b\u4fe1\u606f\u5c31\u662f\u786e\u5b9a\u4e00\u4e2a\u5206\u5b50\u7684\u201c\u53d8\u91cf\u201d\u3002<\/p>\n<p>\u5c06\u8fd9\u4e00\u601d\u8def\u5e94\u7528\u5230\u56fe\u7684\u5b8c\u5907\u6027\u4e0a\uff0c\u6211\u4eec\u53ef\u4ee5\u5c06\u56fe\u4e2d\u7684\u8282\u70b9\u548c\u8fb9\u6bd4\u4f5c\u5206\u5b50\u4e2d\u7684\u539f\u5b50\u548c\u5316\u5b66\u952e\u3002\u786e\u5b9a\u4e00\u4e2a\u56fe\u540c\u6837\u9700\u8981\u4e00\u5b9a\u7684\u201c\u53d8\u91cf\u201d\uff0c\u5177\u4f53\u5305\u62ec\uff1a<\/p>\n<ul>\n<li>\u8282\u70b9\u7684\u79cd\u7c7b\u548c\u6570\u91cf\uff1a\u56fe\u4e2d\u6709\u591a\u5c11\u79cd\u7c7b\u7684\u8282\u70b9\uff0c\u6bcf\u79cd\u8282\u70b9\u7684\u6570\u91cf\u662f\u591a\u5c11\u3002<\/li>\n<li>\u8282\u70b9\u95f4\u7684\u8fde\u63a5\u65b9\u5f0f\uff1a\u54ea\u4e9b\u8282\u70b9\u4e4b\u95f4\u5b58\u5728\u8fb9\uff0c\u4ee5\u53ca\u8fd9\u4e9b\u8fb9\u7684\u7c7b\u578b\uff08\u65e0\u5411\u8fb9\u3001\u6709\u5411\u8fb9\u3001\u52a0\u6743\u8fb9\u7b49\uff09\u3002<\/li>\n<li>\u56fe\u7684\u5168\u5c40\u7ed3\u6784\uff1a\u8282\u70b9\u548c\u8fb9\u5728\u56fe\u4e2d\u7684\u6574\u4f53\u7a7a\u95f4\u6392\u5e03\u548c\u5173\u7cfb\u3002<\/li>\n<\/ul>\n<h2><img decoding=\"async\" src=\"https:\/\/img.icons8.com\/?size=100&id=g5NKcBykEi6f&format=png&color=000000\" style=\"height:50px;display:inline\"> \u56fe\u7684\u8282\u70b9\u5c5e\u6027<\/h2>\n<hr \/>\n<h3>\u56fe\u7684\u5ea6\u4e2d\u5fc3\u6027(Degree Centrality)<\/h3>\n<p>\u8282\u70b9\u7684\u5ea6\uff08Node degree\uff09<\/p>\n<p>\uff081\uff09\u65e0\u5411\u56fe\u8282\u70b9\u7684\u5ea6\u4e3a\uff1a\u4e0e\u8be5\u8282\u70b9\u76f8\u5173\u8054\u8fb9\u7684\u6570\u76ee\uff1b<\/p>\n<p>\uff082\uff09\u6709\u5411\u56fe\u8282\u70b9\u7684\u51fa\u5ea6\u4e3a\uff1a\u7531\u8be5\u8282\u70b9\u53d1\u51fa\u7684\u8fb9\u7684\u6570\u76ee\uff1b<\/p>\n<p>\uff083\uff09\u6709\u5411\u56fe\u7684\u8282\u70b9\u7684\u5165\u5ea6\u4e3a\uff1a\u4ee5\u8be5\u8282\u70b9\u4e3a\u7ec8\u70b9\u7684\u8fb9\u7684\u6570\u76ee\uff1b<\/p>\n<p>\u5ea6\u4e2d\u5fc3\u6027\u662f\u5728\u7f51\u7edc\u5206\u6790\u4e2d\u523b\u753b\u8282\u70b9\u4e2d\u5fc3\u6027\uff08Centrality\uff09\u7684\u6700\u76f4\u63a5\u5ea6\u91cf\u6307\u6807\u3002\u4e00\u4e2a\u8282\u70b9\u7684\u8282\u70b9\u5ea6\u8d8a\u5927\u5c31\u610f\u5473\u7740\u8fd9\u4e2a\u8282\u70b9\u7684\u5ea6\u4e2d\u5fc3\u6027\u8d8a\u9ad8\uff0c\u8be5\u8282\u70b9\u5728\u7f51\u7edc\u4e2d\u5c31\u8d8a\u91cd\u8981\u3002\u901a\u5e38\uff0c\u4e3a\u4e86\u4fbf\u4e8e\u6bd4\u8f83\u6216\u8005\u8fdb\u884c\u5176\u5b83\u8ba1\u7b97\uff0c\u9700\u8981\u5c06\u5ea6\u4e2d\u5fc3\u6027\u8fdb\u884c\u6807\u51c6\u5316\u3002\u6807\u51c6\u5316\u7684\u65b9\u5f0f\u901a\u5e38\u662f\u6bcf\u4e2a\u9876\u70b9\u7684\u5ea6\u9664\u4ee5\u56fe\u4e2d\u53ef\u80fd\u7684\u6700\u5927\u5ea6\u6570\uff0c\u5373 N-1\uff0c\u5176\u4e2d N \u8868\u793a\u56fe\u4e2d\u7684\u9876\u70b9\u4e2a\u6570\uff0c\u6807\u51c6\u5316\u516c\u5f0f\u4e3a\uff1a<\/p>\n<p>$$<br \/>\n\\text { norm }(\\text { degree })=\\frac{\\text { degree }}{N-1}<br \/>\n$$<\/p>\n<p>\u5982\u4e0b\u56fe\u6240\u793a\uff0c\u8282\u70b9\u5218\u5907\u7684\u4e2d\u5fc3\u6027\u7b49\u4e8e5\/6\uff0c\u8282\u70b9\u4e8e\u7981\u7684\u4e2d\u5fc3\u6027\u7b49\u4e8e0\uff0c\u8282\u70b9\u5173\u7fbd\u7684\u4e2d\u5fc3\u6027\u7b49\u4e8e2\/6\u3002.<\/p>\n<p align=\"center\">\n  <img decoding=\"async\" src=\"https:\/\/gnnclub-1311496010.cos.ap-beijing.myqcloud.com\/wp-content\/uploads\/2024\/07\/20240729194826134.png\" style=\"height:300px\">\n<\/p>\n<h3>\u56fe\u7684\u7279\u5f81\u5411\u91cf\u4e2d\u5fc3\u6027(Eigenvector Centrality)<\/h3>\n<p>\u5728\u56fe\u8bba\u4e2d\uff0c\u7279\u5f81\u5411\u91cf\u4e2d\u5fc3\u6027\u662f\u4e00\u79cd\u5ea6\u91cf\u8282\u70b9\u91cd\u8981\u6027\u7684\u65b9\u6cd5\u3002\u5b83\u4e0d\u4ec5\u8003\u8651\u4e00\u4e2a\u8282\u70b9\u7684\u5ea6\u6570\uff0c\u8fd8\u8003\u8651\u4e0e\u8be5\u8282\u70b9\u76f8\u8fde\u7684\u8282\u70b9\u7684\u4e2d\u5fc3\u6027\u3002\u7b80\u800c\u8a00\u4e4b\uff0c\u4e00\u4e2a\u8282\u70b9\u7684\u7279\u5f81\u5411\u91cf\u4e2d\u5fc3\u6027\u4e0d\u4ec5\u53d6\u51b3\u4e8e\u5b83\u7684\u90bb\u5c45\u6570\u91cf\uff0c\u8fd8\u53d6\u51b3\u4e8e\u5b83\u90bb\u5c45\u7684\u4e2d\u5fc3\u6027\u3002\u73b0\u5728\u7528\u4e00\u4e2a\u957f\u5ea6\u4e3a5\u7684\u5411\u91cf\u6765\u8868\u793a\u8282\u70b9x\u7684\u4fe1\u606f,\u00a0A\u6765\u8868\u793a\u4e34\u754c\u77e9\u9635\uff0c\u5982\u4e0b\u56fe<\/p>\n<p align=\"center\">\n  <img decoding=\"async\" src=\"https:\/\/gnnclub-1311496010.cos.ap-beijing.myqcloud.com\/wp-content\/uploads\/2024\/07\/20240729195221103.png\" style=\"height:300px\">\n<\/p>\n<p>\u5f53 x \u548c A \u76f8\u4e58\u65f6\uff0c\u7ed3\u679c\u662f\u90bb\u63a5\u77e9\u9635\u5bf9\u6bcf\u4e2a\u8282\u70b9\u7684\u90bb\u5c45\u8282\u70b9\u7279\u5f81\u8fdb\u884c\u91cd\u65b0\u5206\u914d\u3002<br \/>\n$$<br \/>\n\\boldsymbol{A} \\times \\boldsymbol{x}=\\left[\\begin{array}{lllll}<br \/>\n0 &amp; 1 &amp; 0 &amp; 0 &amp; 0 \\\\<br \/>\n1 &amp; 0 &amp; 0 &amp; 0 &amp; 0 \\\\<br \/>\n0 &amp; 0 &amp; 0 &amp; 1 &amp; 1 \\\\<br \/>\n0 &amp; 0 &amp; 1 &amp; 0 &amp; 1 \\\\<br \/>\n0 &amp; 0 &amp; 1 &amp; 1 &amp; 0<br \/>\n\\end{array}\\right]\\left[\\begin{array}{l}<br \/>\nx_1 \\\\<br \/>\nx_2 \\\\<br \/>\nx_3 \\\\<br \/>\nx_4 \\\\<br \/>\nx_5<br \/>\n\\end{array}\\right]=\\left[\\begin{array}{l}<br \/>\n0 \\cdot x_1+1 \\cdot x_2+0 \\cdot x_3+0 \\cdot x_4+0 \\cdot x_5 \\\\<br \/>\n1 \\cdot x_1+0 \\cdot x_2+0 \\cdot x_3+0 \\cdot x_4+0 \\cdot x_5 \\\\<br \/>\n0 \\cdot x_1+0 \\cdot x_2+0 \\cdot x_3+1 \\cdot x_4+1 \\cdot x_5 \\\\<br \/>\n0 \\cdot x_1+0 \\cdot x_2+1 \\cdot x_3+0 \\cdot x_4+1 \\cdot x_5 \\\\<br \/>\n0 \\cdot x_1+0 \\cdot x_2+1 \\cdot x_3+1 \\cdot x_4+0 \\cdot x_5<br \/>\n\\end{array}\\right]<br \/>\n$$<\/p>\n<p>\u6839\u636e\u7ebf\u6027\u4ee3\u6570\u4e2d\u5173\u4e8e\u7279\u5f81\u503c\u548c\u7279\u5f81\u5411\u91cf\u7684\u77e5\u8bc6, \u7279\u5f81\u5411\u91cf\u4e2d\u5fc3\u6027\u662f\u901a\u8fc7\u6c42\u89e3\u4ee5\u4e0b\u7279\u5f81\u503c\u95ee\u9898\u5f97\u5230\u7684\uff1a $\\boldsymbol{A} \\times \\boldsymbol{x}=\\lambda \\times  \\boldsymbol{x}$ \u3002\u5176\u4e2d\uff0c $\\lambda$ \u662f\u7279\u5f81\u503c\uff0c $\\boldsymbol{x}$ \u662f\u5bf9\u5e94\u7684\u7279\u5f81\u5411\u91cf\u3002<\/p>\n<h3>\u56fe\u7684\u4e2d\u4ecb\u4e2d\u5fc3\u6027(Betweenness Centrality)<\/h3>\n<p>\u4e2d\u4ecb\u4e2d\u5fc3\u6027\u7684\u601d\u60f3\u662f\uff1a\u5982\u679c\u4e00\u4e2a\u6210\u5458\u4f4d\u4e8e\u5176\u5b83\u6210\u5458\u7684\u591a\u6761\u6700\u77ed\u8def\u5f84\u4e0a\uff0c\u90a3\u4e48\u8be5\u6210\u5458\u5c31\u662f\u6838\u5fc3\u6210\u5458\uff0c\u5c31\u5177\u6709\u8f83\u5927\u7684\u4e2d\u4ecb\u4e2d\u5fc3\u6027\u3002\u5b83\u662f\u6307\u7f51\u7edc\u4e2d\u7ecf\u8fc7\u67d0\u70b9\u5e76\u8fde\u63a5\u8fd9\u4e24\u70b9\u7684\u6700\u77ed\u8def\u5f84\u5360\u8fd9\u4e24\u70b9\u4e4b\u95f4\u7684\u6700\u77ed\u8def\u5f84\u7ebf\u603b\u6570\u4e4b\u6bd4\u3002\u4ee5\u7ecf\u8fc7\u67d0\u4e2a\u8282\u70b9\u7684\u6700\u77ed\u8def\u5f84\u6570\u76ee\u6765\u523b\u753b\u8282\u70b9\u7684\u91cd\u8981\u6027\u6307\u6807\uff0c\u516c\u5f0f\u5982\u4e0b\uff1a<\/p>\n<p>$$<br \/>\nB C=\\sum_{s, t \\in i} \\frac{d_{s t}(i)}{d_{s t}}<br \/>\n$$<\/p>\n<p>\u5176\u4e2d$d_{s t}$ \u8868\u793a $s$ \u5230 $t$ \u7684\u6700\u77ed\u8def\u5f84\u6570\u91cf,  $d_{s t}(i)$ \u8868\u793a\u4ece $s$ \u5230 $t$ \u6700\u77ed\u8def\u5f84\u4e2d\u7ecf\u8fc7 $i$ \u8282\u70b9\u7684\u6570\u91cf\u3002\u4e3e\u4f8b\u8ba1\u7b97\u4e0b\u56fe\u8282\u70b9\u5218\u5907\u7684\u4e2d\u4ecb\u4e2d\u5fc3\u6027\uff1a\u8282\u70b9\u5f20\u98de\u5206\u522b\u5230\u5176\u5b83\u4e94\u4e2a\u8282\u70b9\u7684\u6700\u77ed\u8def\u5f84\u4e00\u5171\u6709\u4e94\u6761\uff0c\u5176\u4e2d\u6709\u56db\u6761\u90fd\u7ecf\u8fc7\u8282\u70b9\u5218\u5907\uff08\u5373\uff0c\u53ea\u6709\u5f20\u98de\u2013&gt;\u5173\u7fbd\u8fd9\u6761\u4e0d\u7ecf\u8fc7\uff09\u3002\u540c\u7406\u8ba1\u7b97\u5176\u5b83\u56db\u4e2a\u8282\u70b9\u7684\u60c5\u51b5\uff0c\u5b83\u4eec\u7684\u60c5\u51b5\u76f8\u540c\uff0c\u90fd\u662f\u5206\u522b\u5230\u5176\u5b83\u4e94\u4e2a\u8282\u70b9\u7684\u6700\u77ed\u8def\u5f84\u4e00\u5171\u6709\u4e94\u6761\uff0c\u5176\u4e2d\u5168\u90e8\u90fd\u9700\u8981\u7ecf\u8fc7\u8282\u70b9\u5218\u5907\u3002\u6240\u4ee5\u8282\u70b9\u5218\u5907\u7684\u4e2d\u4ecb\u4e2d\u5fc3\u6027\u7b49\u4e8e$\\frac{4+5+5+5+5}{5+5+5+5+5}=\\frac{24}{25}$<\/p>\n<p align=\"center\">\n  <img decoding=\"async\" src=\"https:\/\/gnnclub-1311496010.cos.ap-beijing.myqcloud.com\/wp-content\/uploads\/2024\/07\/20240729195254427.png\" style=\"height:300px\">\n<\/p>\n<h3>\u56fe\u7684\u63a5\u8fd1\u4e2d\u5fc3\u6027(Closeness Centrality)<\/h3>\n<p>\u56fe\u7684\u63a5\u8fd1\u4e2d\u5fc3\u6027\u53cd\u6620\u5728\u7f51\u7edc\u4e2d\u67d0\u4e00\u8282\u70b9\u4e0e\u5176\u5b83\u8282\u70b9\u4e4b\u95f4\u7684\u63a5\u8fd1\u7a0b\u5ea6\u3002\u5982\u679c\u8282\u70b9\u5230\u56fe\u4e2d\u5176\u5b83\u8282\u70b9\u7684\u6700\u77ed\u8ddd\u79bb\u90fd\u5f88\u5c0f\uff0c\u90a3\u4e48\u5b83\u7684\u63a5\u8fd1\u4e2d\u5fc3\u6027\u5c31\u5f88\u9ad8\u3002\u76f8\u6bd4\u4e2d\u4ecb\u4e2d\u5fc3\u6027\uff0c\u63a5\u8fd1\u4e2d\u5fc3\u6027\u66f4\u63a5\u8fd1\u51e0\u4f55\u4e0a\u7684\u4e2d\u5fc3\u4f4d\u7f6e\u3002<br \/>\n\u5982\u679c\u8fdb\u884c\u5f52\u4e00\u5316\u5904\u7406\uff0c\u5c31\u662f\u6c42\u8fd9\u4e2a\u8282\u70b9\u5230\u5176\u5b83\u6240\u6709\u8282\u70b9\u7684\u5e73\u5747\u6700\u77ed\u8ddd\u79bb\uff0c\u516c\u5f0f\u5982\u4e0b\uff1a<\/p>\n<p>$$<br \/>\nd_i=\\frac{\\sum_{j \\in i} d_{i j}}{n-1}<br \/>\n$$<br \/>\n\u4e00\u4e2a\u8282\u70b9\u7684\u5e73\u5747\u6700\u77ed\u8ddd\u79bb\u8d8a\u5c0f, \u90a3\u4e48\u8fd9\u4e2a\u8fdb\u884c\u7684\u63a5\u8fd1\u4e2d\u5fc3\u6027\u5c31\u8d8a\u5927\u3002\u5982\u679c\u8282\u70b9 $i$ \u548c\u8282\u70b9 $j$\u4e4b\u95f4\u6ca1\u6709\u8def\u5f84\u53ef\u8fbe, \u5219\u5b9a\u4e49 $d_{i j}$ \u4e3a\u65e0\u7a77\u5927, \u5176\u5012\u6570\u4e3a 0 \u3002<br \/>\n$$<br \/>\nC C_i=\\frac{1}{d_i}=\\frac{n-1}{\\sum_{j \\in i} d_{i j}}<br \/>\n$$<\/p>\n<p>\u5176\u4e2d $C C_i$ \u8868\u793a $i$ \u8282\u70b9\u7684\u63a5\u8fd1\u4e2d\u5fc3\u6027, $d_{i j}$  \u8868\u793a $i$ \u5230 $j$ \u7684\u6700\u77ed\u8ddd\u79bb\u3002 $C C_i$ \u503c\u8d8a\u5927, $i$ \u70b9\u7684\u63a5\u8fd1\u4e2d\u5fc3\u6027\u8d8a\u5927\u3002<\/p>\n<p>\u4e0b\u9762\u901a\u8fc7\u4ee3\u7801\u7684\u5f62\u5f0f\u8ba1\u7b97\u56fe\u8282\u70b9\u7684\u76f8\u5173\u5c5e\u6027<\/p>\n<pre><code class=\"language-python\">import torch\nfrom torch_geometric.data import Data\nimport networkx as nx\nimport matplotlib.pyplot as plt\nimport random\n\n# \u751f\u6210\u8282\u70b9\u548c\u8fb9\nnum_nodes = 10\nedge_prob = 0.5\n\n# \u751f\u6210\u8fb9\u5217\u8868\nedges = []\nfor i in range(num_nodes):\n    for j in range(i + 1, num_nodes):\n        if random.random() &lt; edge_prob:\n            edges.append((i, j))\n\n# \u521b\u5efa\u56fe\u6570\u636e\nedge_index = torch.tensor(edges, dtype=torch.long).t().contiguous()\n\n# \u521b\u5efaPyTorch Geometric\u6570\u636e\u5bf9\u8c61\ndata = Data(edge_index=edge_index)\n\n# \u53ef\u89c6\u5316\u56fe\nG = nx.Graph()\nG.add_edges_from(edges)\n\nplt.figure(figsize=(6, 6))\nnx.draw(G, with_labels=True, node_color=&#039;skyblue&#039;, node_size=700, edge_color=&#039;gray&#039;)\nplt.title(&quot;random graph&quot;)\nplt.show()\n<\/code><\/pre>\n<p align=\"center\">\n  <img decoding=\"async\" src=\"http:\/\/www.gnn.club\/wp-content\/uploads\/2024\/07\/output_18_0-1.png\" style=\"height:500px\">\n<\/p>\n<pre><code class=\"language-python\"># \u8ba1\u7b97\u63a5\u8fd1\u4e2d\u5fc3\u6027\ncloseness_centrality = nx.closeness_centrality(G)\n\n# \u8ba1\u7b97\u4e2d\u4ecb\u4e2d\u5fc3\u6027\nbetweenness_centrality = nx.betweenness_centrality(G)\n\n# \u8ba1\u7b97\u7279\u5f81\u5411\u91cf\u4e2d\u5fc3\u6027\neigenvector_centrality = nx.eigenvector_centrality(G)\n\n# \u8ba1\u7b97\u5ea6\u4e2d\u5fc3\u6027\ndegree_centrality = nx.degree_centrality(G)\n\nimport pandas as pd\n\n# \u6574\u7406\u7ed3\u679c\ncentrality_measures = pd.DataFrame({\n    &#039;\u8282\u70b9&#039;: list(G.nodes),\n    &#039;\u63a5\u8fd1\u4e2d\u5fc3\u6027&#039;: [closeness_centrality[node] for node in G.nodes],\n    &#039;\u4e2d\u4ecb\u4e2d\u5fc3\u6027&#039;: [betweenness_centrality[node] for node in G.nodes],\n    &#039;\u7279\u5f81\u5411\u91cf\u4e2d\u5fc3\u6027&#039;: [eigenvector_centrality[node] for node in G.nodes],\n    &#039;\u5ea6\u4e2d\u5fc3\u6027&#039;: [degree_centrality[node] for node in G.nodes]\n})\n\ncentrality_measures<\/code><\/pre>\n<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }<\/p>\n<p>    .dataframe tbody tr th {\n        vertical-align: top;\n    }<\/p>\n<p>    .dataframe thead th {\n        text-align: right;\n    }\n<\/style>\n<table border=\"1\" class=\"dataframe\">\n<thead>\n<tr style=\"text-align: right;\">\n<th><\/th>\n<th>\u8282\u70b9<\/th>\n<th>\u63a5\u8fd1\u4e2d\u5fc3\u6027<\/th>\n<th>\u4e2d\u4ecb\u4e2d\u5fc3\u6027<\/th>\n<th>\u7279\u5f81\u5411\u91cf\u4e2d\u5fc3\u6027<\/th>\n<th>\u5ea6\u4e2d\u5fc3\u6027<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<th>0<\/th>\n<td>0<\/td>\n<td>0.750000<\/td>\n<td>0.101852<\/td>\n<td>0.379320<\/td>\n<td>0.666667<\/td>\n<\/tr>\n<tr>\n<th>1<\/th>\n<td>1<\/td>\n<td>0.600000<\/td>\n<td>0.000000<\/td>\n<td>0.248528<\/td>\n<td>0.333333<\/td>\n<\/tr>\n<tr>\n<th>2<\/th>\n<td>2<\/td>\n<td>0.818182<\/td>\n<td>0.143519<\/td>\n<td>0.438621<\/td>\n<td>0.777778<\/td>\n<\/tr>\n<tr>\n<th>3<\/th>\n<td>3<\/td>\n<td>0.642857<\/td>\n<td>0.055556<\/td>\n<td>0.264186<\/td>\n<td>0.444444<\/td>\n<\/tr>\n<tr>\n<th>4<\/th>\n<td>4<\/td>\n<td>0.692308<\/td>\n<td>0.083333<\/td>\n<td>0.329732<\/td>\n<td>0.555556<\/td>\n<\/tr>\n<tr>\n<th>5<\/th>\n<td>6<\/td>\n<td>0.818182<\/td>\n<td>0.157407<\/td>\n<td>0.430300<\/td>\n<td>0.777778<\/td>\n<\/tr>\n<tr>\n<th>6<\/th>\n<td>9<\/td>\n<td>0.562500<\/td>\n<td>0.009259<\/td>\n<td>0.193775<\/td>\n<td>0.333333<\/td>\n<\/tr>\n<tr>\n<th>7<\/th>\n<td>5<\/td>\n<td>0.562500<\/td>\n<td>0.000000<\/td>\n<td>0.235754<\/td>\n<td>0.333333<\/td>\n<\/tr>\n<tr>\n<th>8<\/th>\n<td>8<\/td>\n<td>0.692308<\/td>\n<td>0.078704<\/td>\n<td>0.315166<\/td>\n<td>0.555556<\/td>\n<\/tr>\n<tr>\n<th>9<\/th>\n<td>7<\/td>\n<td>0.600000<\/td>\n<td>0.009259<\/td>\n<td>0.214075<\/td>\n<td>0.333333<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>\u4e0a\u8ff0\u56fe\u5c5e\u6027\u53ef\u662f\u4f5c\u4e3a\u56fe\u8282\u70b9\u7684\u7279\u5f81\u5411\u91cf\uff0c\u5982\u4e0b\u4ee3\u7801\u6240\u793a<\/p>\n<pre><code class=\"language-python\"># \u6574\u7406\u7ed3\u679c\u5e76\u521b\u5efa\u8282\u70b9\u7279\u5f81\u5411\u91cf\nnode_features = []\nfor node in G.nodes:\n    features = [\n        closeness_centrality[node],\n        betweenness_centrality[node],\n        eigenvector_centrality[node],\n        degree_centrality[node]\n    ]\n    node_features.append(features)\n\n# \u8f6c\u6362\u4e3aPyTorch\u5f20\u91cf\nx = torch.tensor(node_features, dtype=torch.float)\n\n# \u521b\u5efaPyTorch Geometric\u56fe\u6570\u636e\nedge_index = torch.tensor(edges, dtype=torch.long).t().contiguous()\ndata = Data(x=x, edge_index=edge_index)\n\n# \u663e\u793a\u6570\u636e\nprint(data)<\/code><\/pre>\n<pre><code>Data(x=[10, 4], edge_index=[2, 23])<\/code><\/pre>\n<h2><img decoding=\"async\" src=\"https:\/\/img.icons8.com\/?size=100&id=cICYb0jD0JHv&format=png&color=000000\" style=\"height:50px;display:inline\"> \u56fe\u8fb9\u7684\u5c5e\u6027<\/h2>\n<hr \/>\n<p>\u5728\u56fe\u6570\u636e\uff08Graph Data\uff09\u4e2d\uff0c\u8fb9\u5c5e\u6027\uff08Edge Attributes\uff09\u662f\u7528\u4e8e\u63cf\u8ff0\u56fe\u4e2d\u8fb9\uff08\u5373\u8282\u70b9\u95f4\u8fde\u63a5\uff09\u7684\u4e00\u4e9b\u7279\u5f81\u6216\u4fe1\u606f\u7684\u3002\u5efa\u6a21\u8fb9\u5c5e\u6027\u7684\u65b9\u5f0f\u6709\u5f88\u591a\uff0c\u5177\u4f53\u53d6\u51b3\u4e8e\u5e94\u7528\u573a\u666f\u548c\u5206\u6790\u76ee\u6807\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u5e38\u89c1\u7684\u5efa\u6a21\u65b9\u5f0f\uff1a<\/p>\n<ol>\n<li>\u6743\u91cd\uff08Weight\uff09\uff1a<\/li>\n<\/ol>\n<p>\u8fb9\u7684\u6743\u91cd\u901a\u5e38\u7528\u4e8e\u8868\u793a\u4e24\u4e2a\u8282\u70b9\u4e4b\u95f4\u8fde\u63a5\u7684\u5f3a\u5ea6\u3001\u8ddd\u79bb\u3001\u6210\u672c\u6216\u5176\u4ed6\u91cf\u5316\u6307\u6807\u3002\u6bd4\u5982\uff0c\u5728\u793e\u4ea4\u7f51\u7edc\u4e2d\uff0c\u8fb9\u7684\u6743\u91cd\u53ef\u4ee5\u8868\u793a\u670b\u53cb\u4e4b\u95f4\u7684\u4e92\u52a8\u9891\u7387\uff1b\u5728\u8def\u7f51\u4e2d\uff0c\u8fb9\u7684\u6743\u91cd\u53ef\u4ee5\u8868\u793a\u9053\u8def\u7684\u957f\u5ea6\u6216\u901a\u884c\u65f6\u95f4\u3002<\/p>\n<ol start=\"2\">\n<li>\u7c7b\u578b\uff08Type\uff09\uff1a<\/li>\n<\/ol>\n<p>\u8fb9\u7684\u7c7b\u578b\u53ef\u4ee5\u7528\u4e8e\u533a\u5206\u4e0d\u540c\u6027\u8d28\u7684\u8fde\u63a5\u3002\u4f8b\u5982\uff0c\u5728\u77e5\u8bc6\u56fe\u8c31\u4e2d\uff0c\u53ef\u4ee5\u6709\u201c\u670b\u53cb\u201d\u3001\u201c\u540c\u4e8b\u201d\u3001\u201c\u5bb6\u4eba\u201d\u7b49\u4e0d\u540c\u7c7b\u578b\u7684\u5173\u7cfb\u3002<\/p>\n<ol start=\"3\">\n<li>\u65b9\u5411\uff08Direction\uff09\uff1a<\/li>\n<\/ol>\n<p>\u5728\u6709\u5411\u56fe\u4e2d\uff0c\u8fb9\u7684\u65b9\u5411\u8868\u793a\u5173\u7cfb\u7684\u65b9\u5411\u6027\uff0c\u6bd4\u5982\u4ece\u8282\u70b9A\u6307\u5411\u8282\u70b9B\u7684\u8fb9\u8868\u793aA\u5f71\u54cdB\u3002\u5728\u5efa\u6a21\u65f6\uff0c\u9700\u8981\u660e\u786e\u8bb0\u5f55\u6bcf\u6761\u8fb9\u7684\u8d77\u70b9\u548c\u7ec8\u70b9\u3002<\/p>\n<ol start=\"4\">\n<li>\u65f6\u95f4\u6233\uff08Timestamp\uff09\uff1a<\/li>\n<\/ol>\n<p>\u65f6\u95f4\u6233\u53ef\u4ee5\u7528\u4e8e\u8bb0\u5f55\u8fb9\u7684\u521b\u5efa\u65f6\u95f4\u6216\u6d3b\u52a8\u65f6\u95f4\uff0c\u8fd9\u5bf9\u4e8e\u52a8\u6001\u56fe\u6216\u65f6\u95f4\u5e8f\u5217\u56fe\u5c24\u5176\u91cd\u8981\u3002\u4f8b\u5982\uff0c\u5728\u7f51\u7edc\u6d41\u91cf\u56fe\u4e2d\uff0c\u6bcf\u6761\u8fb9\u53ef\u4ee5\u6709\u4e00\u4e2a\u65f6\u95f4\u6233\u8868\u793a\u8be5\u6d41\u91cf\u7684\u53d1\u751f\u65f6\u95f4\u3002<\/p>\n<ol start=\"5\">\n<li>\u5c5e\u6027\u5411\u91cf\uff08Attribute Vector\uff09\uff1a<\/li>\n<\/ol>\n<p>\u8fb9\u5c5e\u6027\u53ef\u4ee5\u4ee5\u5411\u91cf\u5f62\u5f0f\u5b58\u50a8\uff0c\u5305\u542b\u591a\u4e2a\u7ef4\u5ea6\u7684\u4fe1\u606f\u3002\u4f8b\u5982\uff0c\u5728\u63a8\u8350\u7cfb\u7edf\u4e2d\uff0c\u4e00\u6761\u8fb9\u53ef\u4ee5\u6709\u591a\u4e2a\u5c5e\u6027\u5982\u8bc4\u5206\u3001\u8bc4\u8bba\u3001\u6807\u7b7e\u7b49\u3002<\/p>\n<ol start=\"6\">\n<li>\u6982\u7387\uff08Probability\uff09\uff1a<\/li>\n<\/ol>\n<p>\u5728\u4e00\u4e9b\u5e94\u7528\u4e2d\uff0c\u8fb9\u7684\u5b58\u5728\u53ef\u80fd\u662f\u6982\u7387\u6027\u7684\u3002\u4f8b\u5982\uff0c\u5728\u86cb\u767d\u8d28\u76f8\u4e92\u4f5c\u7528\u7f51\u7edc\u4e2d\uff0c\u8fb9\u7684\u6982\u7387\u53ef\u4ee5\u8868\u793a\u4e24\u4e2a\u86cb\u767d\u8d28\u76f8\u4e92\u4f5c\u7528\u7684\u53ef\u80fd\u6027\u3002<\/p>\n<ol start=\"7\">\n<li>\u5bb9\u91cf\uff08Capacity\uff09\uff1a<\/li>\n<\/ol>\n<p>\u5728\u6d41\u7f51\u7edc\uff08Flow Network\uff09\u4e2d\uff0c\u8fb9\u7684\u5bb9\u91cf\u8868\u793a\u8fb9\u6240\u80fd\u627f\u8f7d\u7684\u6700\u5927\u6d41\u91cf\u3002\u4f8b\u5982\uff0c\u5728\u4ea4\u901a\u7f51\u7edc\u4e2d\uff0c\u8fb9\u7684\u5bb9\u91cf\u53ef\u4ee5\u8868\u793a\u9053\u8def\u7684\u6700\u5927\u901a\u884c\u8f66\u8f86\u6570\u3002<\/p>\n<ol start=\"8\">\n<li>\u591a\u91cd\u8fb9\uff08Multiedges\uff09\uff1a<\/li>\n<\/ol>\n<p>\u5728\u4e00\u4e9b\u56fe\u4e2d\uff0c\u4e24\u4e2a\u8282\u70b9\u4e4b\u95f4\u53ef\u4ee5\u6709\u591a\u6761\u8fb9\uff0c\u6bcf\u6761\u8fb9\u6709\u4e0d\u540c\u7684\u5c5e\u6027\u3002\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u9700\u8981\u8bb0\u5f55\u6bcf\u6761\u8fb9\u7684\u72ec\u7acb\u5c5e\u6027\u3002<\/p>\n<p>\u5177\u4f53\u5e94\u7528\u4e2d\uff0c\u8fb9\u5c5e\u6027\u7684\u5efa\u6a21\u65b9\u5f0f\u53ef\u80fd\u4f1a\u7ed3\u5408\u4e0a\u8ff0\u51e0\u79cd\u65b9\u5f0f\u3002\u5efa\u6a21\u8fb9\u5c5e\u6027\u7684\u65b9\u5f0f\u9700\u8981\u6839\u636e\u5b9e\u9645\u95ee\u9898\u548c\u6570\u636e\u7279\u70b9\u8fdb\u884c\u9009\u62e9\u548c\u8bbe\u8ba1\uff0c\u4ee5\u4fbf\u6709\u6548\u5730\u8fdb\u884c\u56fe\u5206\u6790\u548c\u5e94\u7528\u3002<\/p>\n<h2><img decoding=\"async\" src=\"https:\/\/img.icons8.com\/?size=100&id=wPka4Cba02N4&format=png&color=000000\" style=\"height:50px;display:inline\"> \u56fe\u7684\u5411\u91cf\u5316<\/h2>\n<hr \/>\n<p>\u56fe\u6570\u636e\u7684\u5d4c\u5165\uff08Embedding\uff09\u662f\u5c06\u56fe\u7ed3\u6784\u4e2d\u7684\u8282\u70b9\u3001\u8fb9\u6216\u6574\u4e2a\u56fe\u8f6c\u5316\u4e3a\u4f4e\u7ef4\u3001\u8fde\u7eed\u3001\u5bc6\u96c6\u7684\u5411\u91cf\u8868\u793a\u7684\u8fc7\u7a0b\uff0c\u8fd9\u4e2a\u8fc7\u7a0b\u4e5f\u88ab\u6210\u4e3a\u5411\u91cf\u5316\u3002\u8fd9\u4e9b\u5411\u91cf\u8868\u793a\uff08\u4e5f\u79f0\u4e3a\u5d4c\u5165\u5411\u91cf\uff09\u6355\u6349\u4e86\u56fe\u4e2d\u7684\u5b9e\u4f53\u53ca\u5176\u5173\u7cfb\u7684\u672c\u8d28\u7279\u5f81\uff0c\u4f7f\u5f97\u56fe\u6570\u636e\u53ef\u4ee5\u88ab\u7528\u4e8e\u5404\u79cd\u673a\u5668\u5b66\u4e60\u548c\u6570\u636e\u5206\u6790\u4efb\u52a1\u3002\u56fe\u5d4c\u5165\u6280\u672f\u7684\u76ee\u7684\u662f\u4fdd\u7559\u539f\u59cb\u56fe\u7ed3\u6784\u7684\u4fe1\u606f\uff0c\u5982\u8282\u70b9\u95f4\u7684\u90bb\u63a5\u5173\u7cfb\u3001\u8def\u5f84\u957f\u5ea6\u548c\u7f51\u7edc\u62d3\u6251\u7279\u6027\uff0c\u540c\u65f6\u5c06\u8fd9\u4e9b\u4fe1\u606f\u538b\u7f29\u5230\u4e00\u4e2a\u4f4e\u7ef4\u7a7a\u95f4\u4e2d\u3002<\/p>\n<h3>\u8282\u70b9\u7684\u5411\u91cf\u5316(Node Embedding)<\/h3>\n<p>\u72ec\u70ed\u7f16\u7801(one-hot)\u662f\u8282\u70b9\u5411\u91cf\u5316\u7684\u4e00\u4e2a\u57fa\u7840\u65b9\u6cd5\u3002\u7b80\u5355\u8bf4\u5c31\u662f\u7528\u4e00\u4e2a\u957f\u5ea6\u4e3a\u8282\u70b9\u6570\u91cf\u7684\u5411\u91cf\u6765\u8868\u793a\u8282\u70b9\u4fe1\u606f\uff0c\u8fd9\u4e2a\u5411\u91cf\u7edd\u5927\u90e8\u5206\u5143\u7d20\u90fd\u662f\u96f6\uff0c\u53ea\u6709\u4e00\u4e2a\u4f4d\u7f6e\u662f1\uff0c\u6240\u4ee5\u79f0\u4e3a\u72ec\u70ed\u7f16\u7801\uff0c\u5982\u4e0b\u56fe\u3002<\/p>\n<p align=\"center\">\n  <img decoding=\"async\" src=\"https:\/\/gnnclub-1311496010.cos.ap-beijing.myqcloud.com\/wp-content\/uploads\/2024\/07\/20240729195333288.png\" style=\"height:300px\">\n<\/p>\n<p>\u8fd9\u79cd\u8868\u793a\u65b9\u5f0f\u867d\u7136\u53ef\u4ee5\u4fdd\u8bc1\u6bcf\u4e2a\u8282\u70b9\u5bf9\u5e94\u4e0d\u540c\u7684\u5411\u91cf\uff0c\u4f46\u662f\u5374\u6709\u4e24\u4e2a\u81f4\u547d\u7684\u7f3a\u70b9\u3002<\/p>\n<ul>\n<li>\uff081\uff09\u7a00\u758f\u6027\uff0c\u5411\u91cf\u4e2d\u7edd\u5927\u90e8\u5206\u5143\u7d20\u90fd\u662f0\u3002\u800c\u4e14\u968f\u7740\u56fe\u5927\u5c0f\u7684\u589e\u52a0\uff0c\u7a00\u758f\u6027\u4f1a\u8ddf\u7740\u589e\u52a0\u3002<\/li>\n<li>\uff082\uff09\u72ec\u70ed\u7f16\u7801\u7684\u5f62\u5f0f\u4e0d\u80fd\u6293\u53d6\u8282\u70b9\u4e2d\u7684\u76f8\u5173\u6027\uff0c\u6bd4\u5982\u8282\u70b9\u5218\u5907\u8ddf\u5176\u5b83\u4e94\u4e2a\u8282\u70b9\u90fd\u76f8\u8fde\uff0c\u4f46\u8fd9\u4e2a\u5173\u7cfb\u5728\u72ec\u70ed\u7f16\u7801\u7684\u5f62\u5f0f\u4e0a\u662f\u4f53\u73b0\u4e0d\u51fa\u6765\u7684\u3002\u5b9e\u9645\u4e0a\uff0c\u8fd9\u516d\u4f4d\u731b\u5c06\u90fd\u662f\u6709\u5185\u5728\u8054\u7cfb\u7684\u3002\u4f8b\u5982\uff1a\u5218\u5173\u5f20\u5728\u6843\u56ed\u7ed3\u4e49\u8fc7\uff1b\u5f20\u98de\uff0c\u5173\u7fbd\uff0c\u9a6c\u8d85\uff0c\u8d75\u4e91\u548c\u9ec4\u5fe0\u540c\u4e3a\u4e94\u864e\u4e0a\u5c06\uff1b\u9ec4\u5fe0\u6bd4\u8f83\u5e74\u8fc8\uff0c\u800c\u8d75\u4e91\u9a6c\u8d85\u6bd4\u8f83\u5e74\u8f7b\uff1b\u4e94\u864e\u4e0a\u5c06\u7684\u6b66\u529b\u503c\u90fd\u662f\u9876\u914d\uff1b\u9a6c\u8d85\u548c\u9ec4\u5fe0\u7684\u51fa\u8eab\u8f83\u597d\u7b49\u7b49\u3002\u6240\u4ee5\u6211\u4eec\u53ef\u4ee5\u6784\u5efa\u5982\u4e0b\u77e9\u9635\uff1a<\/li>\n<\/ul>\n<pre><code class=\"language-python\">import pandas as pd\nimport matplotlib.pyplot as plt\nimport numpy as np\n\n# Define the data based on the image\ndata = {\n    &quot;\u7ed3\u4e49&quot;: [1, 1, 1, 0, 0, 0],\n    &quot;\u4e94\u864e&quot;: [0, 1, 1, 1, 1, 1],\n    &quot;\u5e74\u9f84&quot;: [0.60, 0.55, 0.50, 0.40, 0.46, 0.72],\n    &quot;\u6b66\u529b&quot;: [0.70, 0.99, 0.89, 0.92, 0.87, 0.81],\n    &quot;\u51fa\u8eab&quot;: [0.3, 0.3, 0.3, 0.4, 0.6, 0.7]\n}\n\n# Define the index (row labels)\nindex = [&quot;\u5218\u5907&quot;, &quot;\u5173\u7fbd&quot;, &quot;\u5f20\u98de&quot;, &quot;\u8d75\u4e91&quot;, &quot;\u9a6c\u8d85&quot;, &quot;\u9ec4\u5fe0&quot;]\n\n# Create the DataFrame\ndf = pd.DataFrame(data, index=index)\n\n# Display the DataFrame\ndf\n<\/code><\/pre>\n<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }<\/p>\n<p>    .dataframe tbody tr th {\n        vertical-align: top;\n    }<\/p>\n<p>    .dataframe thead th {\n        text-align: right;\n    }\n<\/style>\n<table border=\"1\" class=\"dataframe\">\n<thead>\n<tr style=\"text-align: right;\">\n<th><\/th>\n<th>\u7ed3\u4e49<\/th>\n<th>\u4e94\u864e<\/th>\n<th>\u5e74\u9f84<\/th>\n<th>\u6b66\u529b<\/th>\n<th>\u51fa\u8eab<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<th>\u5218\u5907<\/th>\n<td>1<\/td>\n<td>0<\/td>\n<td>0.60<\/td>\n<td>0.70<\/td>\n<td>0.3<\/td>\n<\/tr>\n<tr>\n<th>\u5173\u7fbd<\/th>\n<td>1<\/td>\n<td>1<\/td>\n<td>0.55<\/td>\n<td>0.99<\/td>\n<td>0.3<\/td>\n<\/tr>\n<tr>\n<th>\u5f20\u98de<\/th>\n<td>1<\/td>\n<td>1<\/td>\n<td>0.50<\/td>\n<td>0.89<\/td>\n<td>0.3<\/td>\n<\/tr>\n<tr>\n<th>\u8d75\u4e91<\/th>\n<td>0<\/td>\n<td>1<\/td>\n<td>0.40<\/td>\n<td>0.92<\/td>\n<td>0.4<\/td>\n<\/tr>\n<tr>\n<th>\u9a6c\u8d85<\/th>\n<td>0<\/td>\n<td>1<\/td>\n<td>0.46<\/td>\n<td>0.87<\/td>\n<td>0.6<\/td>\n<\/tr>\n<tr>\n<th>\u9ec4\u5fe0<\/th>\n<td>0<\/td>\n<td>1<\/td>\n<td>0.72<\/td>\n<td>0.81<\/td>\n<td>0.7<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>\u901a\u8fc7\u4e0a\u8ff0\u5f62\u5f0f\uff0c\u6211\u4eec\u628aone-hot\u7f16\u7801\uff0c\u4ece\u7a00\u758f\u6001\u53d8\u6210\u4e86\u5bc6\u96c6\u6001\uff0c\u5e76\u4e14\u8ba9\u76f8\u4e92\u72ec\u7acb\u5411\u91cf\u53d8\u6210\u4e86\u6709\u5185\u5728\u8054\u7cfb\u7684\u5173\u7cfb\u5411\u91cf\u3002\u4e0a\u8ff0\u8fd9\u79cd\u5c06\u6570\u636e\u70b9\u8f6c\u5316\u4e3a\u6570\u503c\u5411\u91cf\u5e76\u4f7f\u7528\u77e9\u9635\u8868\u793a\u7684\u65b9\u6cd5\u88ab\u79f0\u4e3a\u67e5\u627e\u8868\uff08Lookup Table\uff09\u3002\u8fd9\u79cd\u65b9\u6cd5\u901a\u8fc7\u4e3a\u6bcf\u4e2a\u552f\u4e00\u7684\u7c7b\u522b\uff08\u5982\u5355\u8bcd\u3001\u6807\u7b7e\u6216\u7b26\u53f7\uff09\u5206\u914d\u4e00\u4e2a\u56fa\u5b9a\u957f\u5ea6\u7684\u5411\u91cf\u6765\u5de5\u4f5c\uff0c\u4f7f\u5f97\u6a21\u578b\u53ef\u4ee5\u5904\u7406\u548c\u5206\u6790\u8fd9\u4e9b\u6570\u636e\u3002\u5176\u4e2d\u6bcf\u884c\u4ee3\u8868\u4e00\u4e2a\u7c7b\u522b\u7684\u5411\u91cf\u8868\u793a\u3002\u8fd9\u4e2a\u77e9\u9635\u7684\u5927\u5c0f\u7531\u4e24\u4e2a\u56e0\u7d20\u51b3\u5b9a\uff1a\u4e00\u662f\u552f\u4e00\u7c7b\u522b\u7684\u6570\u91cf\uff0c\u4e8c\u662f\u5411\u91cf\u7684\u7ef4\u5ea6\u3002\u6bcf\u4e2a\u7c7b\u522b\u88ab\u5206\u914d\u4e00\u4e2a\u552f\u4e00\u7684\u7d22\u5f15\uff0c\u901a\u8fc7\u8fd9\u4e2a\u7d22\u5f15\uff0c\u6211\u4eec\u53ef\u4ee5\u5728\u67e5\u627e\u8868\u4e2d\u68c0\u7d22\u5bf9\u5e94\u7684\u5411\u91cf\u3002<\/p>\n<h3>Lookup Table\u7684\u5b9a\u4e49\u65b9\u6cd5<\/h3>\n<p>Lookup Table,\u4e00\u822c\u6765\u8bf4\u53ef\u4ee5\u6709\u56db\u79cd\u65b9\u5f0f\uff1a\u81ea\u5b9a\u4e49\u65b9\u6cd5\uff0c\u6709\u76d1\u7763\u8bad\u7ec3\u548c\u65e0\u76d1\u7763\u8bad\u7ec3\u3002<\/p>\n<ul>\n<li>\u81ea\u5b9a\u4e49\u65b9\u6cd5\u6700\u4e3a\u7b80\u5355\uff0c\u53ef\u4ee5\u6839\u636e\u7279\u5b9a\u7684\u6570\u636e\u7279\u5f81\u548c\u4efb\u52a1\u9700\u6c42\u8bbe\u8ba1\u81ea\u5b9a\u4e49\u5d4c\u5165\u65b9\u6cd5\u3002\u4f8b\u5982\u4e0a\u56fe\u6240\u8868\u8ff0\u5f62\u5f0f\u5c31\u662f\u4e00\u79cd\u81ea\u5b9a\u4e49\u5d4c\u5165\u7684\u65b9\u6cd5\u3002<\/li>\n<li>\u6709\u76d1\u7763\u8bad\u7ec3\u662f\u751f\u6210\u5408\u7406\u7684Lookup Table\u7684\u53e6\u4e00\u79cd\u65b9\u5f0f\u3002\u5177\u4f53\u6765\u8bf4\uff0c\u8fd9\u4e2a\u8fc7\u7a0b\u5927\u4f53\u4e0a\u5206\u4e3a\u51e0\u4e2a\u7b80\u5355\u7684\u6b65\u9aa4\uff1a\u9996\u5148\u51c6\u5907\u6570\u636e\uff0c\u786e\u4fdd\u6bcf\u4e2a\u6570\u636e\u70b9\u90fd\u6709\u660e\u786e\u7684\u8f93\u5165\u7279\u5f81\u548c\u671f\u671b\u8f93\u51fa\uff08\u5373\u8f93\u5165\u548c\u5bf9\u5e94\u7684\u771f\u503c\uff09\u3002\u7136\u540e\u9009\u62e9\u5408\u9002\u7684GNNs\u6a21\u578b\uff0c\u5e76\u8fdb\u884c\u8bad\u7ec3\uff0c\u5728\u8fd9\u4e2a\u9636\u6bb5\uff0c\u6a21\u578b\u4f1a\u4e0d\u65ad\u66f4\u65b0\u521d\u59cb\u5316\u7684\u7279\u5f81\u5411\u91cf\uff0c\u5c1d\u8bd5\u4f7f\u7528\u66f4\u65b0\u540e\u7684\u7279\u5f81\u5411\u91cf\u6765\u9884\u6d4b\u6b63\u786e\u7684\u8f93\u51fa\u7ed3\u679c\u3002\u8bad\u7ec3\u5b8c\u6210\u540e\uff0c\u7528\u6a21\u578b\u5bf9\u6240\u6709\u53ef\u80fd\u7684\u8f93\u5165\u8fdb\u884c\u8ba1\u7b97\uff0c\u6a21\u578b\u8ba1\u7b97\u5f97\u5230\u7684\u8282\u70b9\u7279\u5f81\u5411\u91cf\u4f1a\u88ab\u7528\u6765\u586b\u5145 Lookup Table\u3002<\/li>\n<li>\u65e0\u76d1\u7763\u5efa\u6a21\u4e5f\u662f\u751f\u6210Lookup Table\u7684\u5e38\u7528\u65b9\u6cd5\uff0c\u6309\u6570\u636e\u7c7b\u578b\u53ef\u4ee5\u5206\u4e3a\u5e8f\u5217\u548c\u56fe\u4e24\u7c7b\uff0c\u9488\u5bf9\u5e8f\u5217\u6570\u636e\uff0c\u5373\u81ea\u7136\u8bed\u8a00\u5904\u7406\u9886\u57df\uff0c\u751f\u6210Embedding\u5e38\u91c7\u7528word2vec\u6216\u7c7b\u4f3c\u7b97\u6cd5\uff08item2vec, doc2vec\u7b49\uff09\u3002\u9488\u5bf9\u56fe\u6570\u636e\uff0c\u4e5f\u5c31\u662f\u672c\u4e66\u8bb2\u89e3\u7684\u51e0\u4f55\u6df1\u5ea6\u5b66\u4e60\u9886\u57df\uff0c\u751f\u6210Embedding\u7684\u7b97\u6cd5\u79f0\u4e3aGraph Embedding\uff0c\u8fd9\u7c7b\u7b97\u6cd5\u5305\u62ecdeepwalk\u3001node2vec\u3001struc2vec\u7b49\uff0c\u5b83\u4eec\u5927\u591a\u91c7\u7528\u968f\u673a\u6e38\u8d70\u65b9\u5f0f\u751f\u6210\u5e8f\u5217\uff0c\u4e0b\u9762\u4ee5\u968f\u673a\u6e38\u8d70\uff08Random Walk\uff09\u4e3a\u4f8b\u8fdb\u884c\u4ecb\u7ecd\u3002<\/li>\n<\/ul>\n<h3>\u968f\u673a\u6e38\u8d70(Random Walk)<\/h3>\n<p>\u4e00\u4e2a\u5408\u7406\u7684\u5411\u91cf\u5316\u5e94\u8be5\u8003\u8651\u76f8\u4f3c\u6027\uff0c\u5373\u5728\u56fe\u4e2d\u76f8\u4e92\u4e34\u8fd1\u7684\u8282\u70b9\u7ecf\u8fc7\u5411\u91cf\u5316\u540e\u5f97\u5230\u7684\u5411\u91cf\u4e5f\u5e94\u8be5\u662f\u76f8\u4f3c\u7684\u3002\u4e5f\u5c31\u662f\u8bf4\uff0c\u5e0c\u671b\u5411\u91cf\u5316\u4e4b\u540e\u7684\u8282\u70b9\u5411\u91cf\u70b9\u4e58\u4e4b\u540e\u7684\u503c\u63a5\u8fd1\u4e8e\u539f\u56fe\u4e2d\u7684\u8282\u70b9\u76f8\u4f3c\u5ea6\u3002<\/p>\n<p>$$<br \/>\n\\operatorname{similarity}(u, v)=z_v^T z_u<br \/>\n$$<\/p>\n<p>\u5728\u968f\u673a\u6e38\u8d70\u7b97\u6cd5\u4e2d\uff0c\u5f53\u7ed9\u5b9a\u4e00\u4e2a\u56fe\u548c\u4e00\u4e2a\u8d77\u59cb\u8282\u70b9u\uff0c\u7136\u540e\u6309\u7167\u4e00\u5b9a\u6982\u7387\u968f\u673a\u9009\u62e9\u4e00\u4e2a\u90bb\u5c45\u8282\u70b9\uff0c\u8d70\u5230\u8be5\u5904\u540e\u518d\u968f\u673a\u9009\u62e9\u4e00\u4e2a\u90bb\u5c45\uff0c\u91cd\u590dlength\u6b21\uff0c\u5230\u6700\u7ec8\u7684\u7ec8\u6b62\u8282\u70b9v\u3002length\u662f\u4e00\u4e2a\u8d85\u53c2\u6570\uff0c\u662f\u6307\u968f\u673a\u6e38\u8d70\u7684\u957f\u5ea6\uff0c\u5982\u4e0b\u56fe\uff1a<\/p>\n<p align=\"center\">\n  <img decoding=\"async\" src=\"https:\/\/gnnclub-1311496010.cos.ap-beijing.myqcloud.com\/wp-content\/uploads\/2024\/07\/20240729195420268.png\" style=\"height:300px\">\n<\/p>\n<p>\u5728\u591a\u6b21\u8fdb\u884c\u968f\u673a\u6e38\u8d70\u540e\uff0c\u968f\u673a\u6e38\u8d70\u4ece\u8d77\u59cb\u8282\u70b9u\u5230\u7ec8\u6b62\u8282\u70b9\u7684\u6b21\u6570v\uff0c\u9664\u4ee5\u968f\u673a\u6e38\u8d70\u7684\u603b\u6b21\u6570\u5f97\u5230\u7684\u6982\u7387\u503c\uff0c\u5b9e\u9645\u4e0a\u5c31\u53ef\u4ee5\u7528\u6765\u8868\u793a\u76f8\u4f3c\u5ea6\u3002<\/p>\n<p>\u4e5f\u5c31\u662f\u8bf4\uff0c\u4ece\u8282\u70b9u\u5230\u8282\u70b9v\u7684\u6982\u7387\u503c\uff0c\u5e94\u8be5\u6b63\u6bd4\u4e8e\u8282\u70b9u\u4e0e\u8282\u70b9v\u5411\u91cf\u5316\u4e4b\u540e\u7684\u70b9\u4e58\u7ed3\u679c\u3002<\/p>\n<p>\u8fd9\u79cd\u65b9\u6cd5\u6709\u4e24\u4e2a\u4f18\u70b9\uff1a<\/p>\n<p>\uff081\uff09\u76f8\u4f3c\u5ea6\u7684\u5b9a\u4e49\u7ed3\u5408\u4e86\u56fe\u7684\u5c40\u90e8\u4fe1\u606f\u3002<\/p>\n<p>\uff082\uff09\u53ea\u9700\u8981\u8003\u8651\u968f\u673a\u6e38\u8d70\u7684\u8282\u70b9\uff0c\u4e0d\u9700\u8981\u8003\u8651\u5168\u5c40\u4fe1\u606f\uff0c\u8282\u7701\u8ba1\u7b97\u590d\u6742\u5ea6\uff0c\u6548\u7387\u9ad8\u3002<\/p>\n<p>\u76f8\u5173\u4ee3\u7801\u53c2\u8003\u5982\u4e0b\uff1a<\/p>\n<pre><code class=\"language-python\">import networkx as nx\nfrom node2vec import Node2Vec\nimport matplotlib.pyplot as plt\nimport pandas as pd\n\n# \u521b\u5efa\u4e00\u4e2a\u968f\u673a\u56fe\nG = nx.erdos_renyi_graph(n=20, p=0.2, seed=42)\n\n# \u4f7f\u7528node2vec\u8fdb\u884c\u968f\u673a\u6e38\u8d70\u548c\u8bad\u7ec3\nnode2vec = Node2Vec(G, dimensions=32, walk_length=30, num_walks=200)\nmodel = node2vec.fit(window=10, min_count=1)\n\n# \u83b7\u53d6\u6bcf\u4e2a\u8282\u70b9\u7684\u5411\u91cf\u8868\u793a\nembeddings = {str(node): model.wv[str(node)] for node in G.nodes()}\n\n# \u5c06\u5d4c\u5165\u8f6c\u6362\u4e3aDataFrame\nembeddings_df = pd.DataFrame(embeddings).T\nembeddings_df.columns = [f&#039;feature_{i}&#039; for i in range(embeddings_df.shape[1])]\n\nembeddings_df.head()<\/code><\/pre>\n<pre><code>\/home\/arwin\/anaconda3\/envs\/GNN\/lib\/python3.8\/site-packages\/tqdm\/auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https:\/\/ipywidgets.readthedocs.io\/en\/stable\/user_install.html\n  from .autonotebook import tqdm as notebook_tqdm\nComputing transition probabilities: 100%|\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588| 20\/20 [00:00<00:00, 24520.92it\/s]\nGenerating walks (CPU: 1): 100%|\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588| 200\/200 [00:00<00:00, 1220.59it\/s]<\/code><\/pre>\n<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }<\/p>\n<p>    .dataframe tbody tr th {\n        vertical-align: top;\n    }<\/p>\n<p>    .dataframe thead th {\n        text-align: right;\n    }\n<\/style>\n<table border=\"1\" class=\"dataframe\">\n<thead>\n<tr style=\"text-align: right;\">\n<th><\/th>\n<th>feature_0<\/th>\n<th>feature_1<\/th>\n<th>feature_2<\/th>\n<th>feature_3<\/th>\n<th>feature_4<\/th>\n<th>feature_5<\/th>\n<th>feature_6<\/th>\n<th>feature_7<\/th>\n<th>feature_8<\/th>\n<th>feature_9<\/th>\n<th>...<\/th>\n<th>feature_22<\/th>\n<th>feature_23<\/th>\n<th>feature_24<\/th>\n<th>feature_25<\/th>\n<th>feature_26<\/th>\n<th>feature_27<\/th>\n<th>feature_28<\/th>\n<th>feature_29<\/th>\n<th>feature_30<\/th>\n<th>feature_31<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<th>0<\/th>\n<td>-0.118865<\/td>\n<td>-0.487450<\/td>\n<td>0.112956<\/td>\n<td>0.389164<\/td>\n<td>-0.018240<\/td>\n<td>-0.409379<\/td>\n<td>0.197791<\/td>\n<td>-0.046330<\/td>\n<td>-0.112694<\/td>\n<td>-0.095146<\/td>\n<td>...<\/td>\n<td>0.302146<\/td>\n<td>-0.249836<\/td>\n<td>0.116794<\/td>\n<td>-0.286903<\/td>\n<td>0.002138<\/td>\n<td>0.169646<\/td>\n<td>-0.019117<\/td>\n<td>-0.001418<\/td>\n<td>-0.275610<\/td>\n<td>-0.138597<\/td>\n<\/tr>\n<tr>\n<th>1<\/th>\n<td>-0.152091<\/td>\n<td>-0.421093<\/td>\n<td>0.096536<\/td>\n<td>0.293265<\/td>\n<td>0.094914<\/td>\n<td>-0.274414<\/td>\n<td>0.269710<\/td>\n<td>0.095678<\/td>\n<td>-0.086385<\/td>\n<td>0.088134<\/td>\n<td>...<\/td>\n<td>0.343753<\/td>\n<td>-0.329543<\/td>\n<td>0.219653<\/td>\n<td>0.048745<\/td>\n<td>-0.219035<\/td>\n<td>0.047592<\/td>\n<td>-0.100183<\/td>\n<td>-0.103925<\/td>\n<td>-0.180907<\/td>\n<td>-0.206220<\/td>\n<\/tr>\n<tr>\n<th>2<\/th>\n<td>0.040840<\/td>\n<td>-0.057727<\/td>\n<td>0.419276<\/td>\n<td>0.137538<\/td>\n<td>0.089489<\/td>\n<td>-0.363980<\/td>\n<td>0.242473<\/td>\n<td>0.042467<\/td>\n<td>0.104074<\/td>\n<td>0.215268<\/td>\n<td>...<\/td>\n<td>0.430559<\/td>\n<td>-0.315350<\/td>\n<td>0.196646<\/td>\n<td>0.044124<\/td>\n<td>-0.096702<\/td>\n<td>0.084132<\/td>\n<td>0.225040<\/td>\n<td>0.012377<\/td>\n<td>-0.119396<\/td>\n<td>-0.148297<\/td>\n<\/tr>\n<tr>\n<th>3<\/th>\n<td>-0.171008<\/td>\n<td>-0.440018<\/td>\n<td>0.091092<\/td>\n<td>0.361489<\/td>\n<td>-0.078338<\/td>\n<td>-0.145103<\/td>\n<td>0.447827<\/td>\n<td>0.011616<\/td>\n<td>-0.200889<\/td>\n<td>0.041857<\/td>\n<td>...<\/td>\n<td>0.266206<\/td>\n<td>0.136963<\/td>\n<td>0.164407<\/td>\n<td>-0.011901<\/td>\n<td>-0.153485<\/td>\n<td>0.301768<\/td>\n<td>-0.015566<\/td>\n<td>-0.045155<\/td>\n<td>-0.240233<\/td>\n<td>-0.008514<\/td>\n<\/tr>\n<tr>\n<th>4<\/th>\n<td>-0.010144<\/td>\n<td>-0.004721<\/td>\n<td>0.018429<\/td>\n<td>0.004732<\/td>\n<td>-0.002263<\/td>\n<td>0.029166<\/td>\n<td>-0.015379<\/td>\n<td>-0.002620<\/td>\n<td>0.028673<\/td>\n<td>0.021092<\/td>\n<td>...<\/td>\n<td>0.020628<\/td>\n<td>0.027938<\/td>\n<td>-0.002109<\/td>\n<td>0.009303<\/td>\n<td>-0.019086<\/td>\n<td>0.005310<\/td>\n<td>-0.021644<\/td>\n<td>-0.027169<\/td>\n<td>-0.018438<\/td>\n<td>-0.027989<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>5 rows \u00d7 32 columns<\/p>\n<\/div>\n<h3>\u56fe\u5168\u5c40\u4fe1\u606f\u7684\u5411\u91cf\u5316(Global Information Embedding)<\/h3>\n<p>\u56fe\u5168\u5c40\u4fe1\u606f\u7684\u5411\u91cf\u5316\u5c31\u662f\u8003\u8651\u600e\u4e48\u628a\u6574\u4e2a\u56fe\u7684\u4fe1\u606f\u6620\u5c04\u6210\u4e00\u4e2a\u56fe\u5411\u91cf\u3002\u805a\u5408\u662f\u6700\u7b80\u5355\u7684\u5f97\u5230\u56fe\u5411\u91cf\u7684\u65b9\u6cd5\u3002\u5c31\u662f\u7b80\u5355\u7684\u5bf9\u56fe\u4e2d\u6240\u6709\u7684\u8282\u70b9\u5411\u91cf\u6c42\u548c\u6216\u6c42\u5e73\u5747\uff0c\u5e76\u5c06\u8fd9\u4e2a\u7ed3\u679c\u4f5c\u4e3a\u56fe\u5411\u91cf\u3002\u8fd9\u4e2a\u65b9\u6cd5\u867d\u7136\u7b80\u5355\uff0c\u4f46\u5b9e\u9645\u64cd\u4f5c\u65f6\uff0c\u6548\u679c\u8fd8\u662f\u5f88\u597d\u7684\u3002<\/p>\n<p>\u53e6\u4e00\u79cd\u65b9\u6cd5\u662f\u5728\u6574\u4e2a\u56fe\u7684\u57fa\u7840\u4e0a\uff0c\u521b\u9020\u4e00\u4e2a\u865a\u62df\u8282\u70b9\uff08virtual node\uff09\uff0c\u5982\u4e0b\u56fe\u6240\u793a\u3002\u8fd9\u4e2a\u865a\u62df\u8282\u70b9\u4e0e\u5168\u56fe\u6240\u6709\u8282\u70b9\u76f8\u8fde\u3002\u5728\u56fe\u6a21\u578b\u7684\u8bad\u7ec3\u9636\u6bb5\uff0c\u8fd9\u4e2a\u865a\u62df\u8282\u70b9\u4f1a\u4e0e\u5168\u56fe\u7684\u8282\u70b9\u8fdb\u884c\u4fe1\u606f\u7684\u4ea4\u4e92\uff0c\u56e0\u6b64\uff0c\u5b83\u53ef\u4ee5\u4e00\u5b9a\u7a0b\u5ea6\u4e0a\u8868\u5f81\u5168\u56fe\u4fe1\u606f\u3002\u5f53\u8bad\u7ec3\u7ed3\u675f\u540e\uff0c\u53ef\u4ee5\u53d6\u8be5\u865a\u62df\u8282\u70b9\u7684\u8282\u70b9\u5411\u91cf\u4f5c\u4e3a\u56fe\u5411\u91cf\u3002<\/p>\n<p align=\"center\">\n  <img decoding=\"async\" src=\"https:\/\/gnnclub-1311496010.cos.ap-beijing.myqcloud.com\/wp-content\/uploads\/2024\/07\/20240729195454561.png\" style=\"height:300px\">\n<\/p>\n<h3>\u8fb9\u7684\u5411\u91cf\u5316(Edge Embedding)<\/h3>\n<p>\u81f3\u4e8e\u8fb9\u7684\u5411\u91cf\u5316\uff0c\u4e5f\u6bd4\u8f83\u7b80\u5355\u3002\u53ef\u4ee5\u7b80\u5355\u7684\u5c06\u8be5\u8fb9\u76f8\u8fde\u7684\u4e24\u4e2a\u8282\u70b9\u5411\u91cf\u505a\u805a\u5408\u5373\u53ef\u3002\u9664\u6b64\u4e4b\u5916\uff0c\u8fb9\u7684\u5411\u91cf\u5316\u4e5f\u53ef\u4ee5\u5177\u4f53\u95ee\u9898\u5177\u4f53\u5bf9\u5f85\uff0c\u5373\u81ea\u5b9a\u4e49\u7684\u65b9\u5f0f\u3002\u4e3e\u4f8b\uff1a\u5982\u679c\u56fe\u7ed3\u6784\u8868\u793a\u7684\u662f\u4e00\u4e2a\u5206\u5b50\uff0c\u5176\u4e2d\u8fb9\u8868\u793a\u4e24\u4e2a\u539f\u5b50\u662f\u5426\u76f8\u8fde\u3002\u6b64\u65f6\u8fb9\u7684\u6027\u8d28\u5305\u62ec\u662f\u5426\u662f\u53cc\u952e\u3001\u662f\u5426\u662f\u73af\u7ed3\u6784\u3001\u662f\u5426\u662f\u5171\u4ef7\u952e\u3001\u76f8\u8fde\u7684\u539f\u5b50\u662f\u5426\u662f\u78b3\u539f\u5b50\u7b49\u7b49\u3002\u90a3\u4e48\u53ef\u4ee5\u7528\u4e00\u4e2a\u957f\u5ea6\u662f\u56db\u7ef4\u7684\u76f8\u8fde\u6765\u8868\u793a\u8fd9\u4e2a\u8fb9\u3002\u4f8b\u5982 [1, 0, 0, 1] \u53ef\u4ee5\u8868\u793a\u8fd9\u4e2a\u8fb9\u662f\u4e00\u4e2a\u8fde\u63a5\u78b3\u539f\u5b50\u7684\u53cc\u952e\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Deep Learning Math \u56fe\u8bba\uff08graph Theory\uff09 \u56fe\u8bba\u5728\u6df1\u5ea6\u5b66\u4e60\u4e2d\u7528\u4e8e\u5904\u7406\u548c\u5206\u6790\u7ed3\u6784\u5316\u6570 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1648,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[14],"tags":[],"class_list":["post-1545","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-14"],"_links":{"self":[{"href":"http:\/\/www.gnn.club\/index.php?rest_route=\/wp\/v2\/posts\/1545","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.gnn.club\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.gnn.club\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.gnn.club\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.gnn.club\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1545"}],"version-history":[{"count":25,"href":"http:\/\/www.gnn.club\/index.php?rest_route=\/wp\/v2\/posts\/1545\/revisions"}],"predecessor-version":[{"id":1709,"href":"http:\/\/www.gnn.club\/index.php?rest_route=\/wp\/v2\/posts\/1545\/revisions\/1709"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/www.gnn.club\/index.php?rest_route=\/wp\/v2\/media\/1648"}],"wp:attachment":[{"href":"http:\/\/www.gnn.club\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1545"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.gnn.club\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1545"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.gnn.club\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1545"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}