将CSV转换为PYG图

发布于 2025-02-08 08:48:54 字数 2252 浏览 3 评论 0原文

我有一个CSV数据集,如下所示:

索引s_key标识符edge_pairs
01683,1684,1685,1686,1688,1688,1689,1691,1691,1692,1693,1694,1694,1695,1695,1696,1697,1697,1698,1698,1699,1699,12740][ 0][[0,793]]
[9774,9800,9807,9818,9818,9831,9834,9836,9837,9837,9839,9843,13723,21455]1 123],[1,152],[1,163],[1,266],[1,337],[1,351],[1,352],[1,355],[1,355],[1,606] ,[1,869],[1,962],[1,1125],[1,1412],[1,1413],[1,1417],[1,1435],[1,1440],[1,1440],[ 1,1454],[1,1572],[1,1588],[1,1653],[1,1726],[1,1898],[1,2075],[1,2076],[1,2076],[1 2166],[1,2297],[1,2299],[1,2319],[1,2327],[1,2330],[1,2335],[1,2393],[1,2393],[1,2395] ,[1,2400],[1,2405],[1,2486]]
3[2156,2896,3028,4023,4256,6787,7265,7265,8882,8970,9831 , 17264, 18906, 20430, 21747, 22228, 22229, 22512, 22841, 24049, 25104, 25394, 25731, 26045, 26103, 31121, 31522, 31839, 31851, 31859, 31872, 35527, 35547, 36538, 37150, 37345 ,37692,37888,37895,38962,45332][0,3][[3,8],[3,11],[3,12],[3,12],[3,13],[3],[3,27],[3,[3 34],[3,99],[3,123],[3,125],[3,130],[3,132],[3,133],[3,134],[3,144] ,[3,147],[3,152],[3,154],[3,180],[3,181],[3,207]]
4[25203,25204,25215,25215,25219,25227,25227,25232 ,25235,25248,25251,25252,25259,25270][0,4][[4,215],[4,322],[4,342],[4,342],[4,793],[4,1043],[4,1043],[ 4,1127],[4,1176],[4,1454],[4,2154],[4,2284],[4,2331],[4,2400],[4,2400],[4,2759],[4,[4,[4,] 2920], [4, 3335]]
5[27099, 27101, 27104, 27107, 27108, 27111, 27117, 27120, 27123, 27131, 27143, 27153, 27156, 27158, 27162, 27167, 27172, 27175, 27176, 27178 ,27184,27185][0,5][[5,8],[5,239],[5,378],[5,1163],[5,1220],[5,1378],[5,[5,[5,[5,5, 1422],[5,1440],[5,1636],[5,1681],[5,2190],[5,2303],[5,2399]

]每个节点。

edge_pairs列表示每个节点的连接。 例如:在索引0中,边缘对列:[[[0,793]]表示节点0与节点793的连接,依此类推。

我想以pyg接受data = data = data(x = x,edge_index = edge_index,y = y)的格式从此CSV中绘制图形。 我不确定该如何作为node&标签以及如何表示边缘之间的连接。

I have a CSV dataset as shown below:

indexs_keyidentifieredge_pairs
0[1683, 1684, 1685, 1686, 1688, 1689, 1691, 1692, 1693, 1694, 1695, 1696, 1697, 1698, 1699, 12740][0, 0][[0, 793]]
1[9774, 9800, 9807, 9818, 9831, 9834, 9836, 9837, 9839, 9843, 13723, 21455][0, 1][[1, 3], [1, 123], [1, 152], [1, 163], [1, 266], [1, 337], [1, 351], [1, 352], [1, 355], [1, 606], [1, 869], [1, 962], [1, 1125], [1, 1412], [1, 1413], [1, 1417], [1, 1435], [1, 1440], [1, 1454], [1, 1572], [1, 1588], [1, 1653], [1, 1726], [1, 1898], [1, 2075], [1, 2076], [1, 2166], [1, 2297], [1, 2299], [1, 2319], [1, 2327], [1, 2330], [1, 2335], [1, 2393], [1, 2395], [1, 2400], [1, 2405], [1, 2486]]
3[2156, 2896, 3028, 4023, 4256, 6787, 7265, 8882, 8970, 9831, 10959, 11268, 11341, 12601, 13737, 17264, 18906, 20430, 21747, 22228, 22229, 22512, 22841, 24049, 25104, 25394, 25731, 26045, 26103, 31121, 31522, 31839, 31851, 31859, 31872, 35527, 35547, 36538, 37150, 37345, 37692, 37888, 37895, 38962, 45332][0, 3][[3, 8], [3, 11], [3, 12], [3, 13], [3, 27], [3, 34], [3, 99], [3, 123], [3, 125], [3, 130], [3, 132], [3, 133], [3, 134], [3, 144], [3, 147], [3, 152], [3, 154], [3, 180], [3, 181], [3, 207]]
4[25203, 25204, 25215, 25219, 25227, 25232, 25235, 25248, 25251, 25252, 25259, 25270][0, 4][[4, 215], [4, 322], [4, 342], [4, 793], [4, 1043], [4, 1127], [4, 1176], [4, 1454], [4, 2154], [4, 2284], [4, 2331], [4, 2400], [4, 2759], [4, 2920], [4, 3335]]
5[27099, 27101, 27104, 27107, 27108, 27111, 27117, 27120, 27123, 27131, 27143, 27153, 27156, 27158, 27162, 27167, 27172, 27175, 27176, 27178, 27184, 27185][0, 5][[5, 8], [5, 239], [5, 378], [5, 1163], [5, 1220], [5, 1378], [5, 1422], [5, 1440], [5, 1636], [5, 1681], [5, 2190], [5, 2303], [5, 2399]]

The index column represents each node.

The edge_pairs column represents the connection of each node.
For example: In Index 0, the edge pair column: [[0, 793]] represents the connection of node 0 with Node 793 and so on.

I want to make a graph out of this CSV in a format that PyG accepts data = Data(x=x, edge_index=edge_index, y=y).
I am unsure of what to take as Node Features & Labels and how to represent the connection of edges between them.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文