当前位置:网站首页>From spark csc. csr_ Matrix generate adjacency matrix
From spark csc. csr_ Matrix generate adjacency matrix
2022-07-06 19:36:00 【NorburyL】
need photo.edglist and cs.edglist
solution1
By output str, and str Operation filtering of .
result
fail, Unable to obtain data completely , There are too many link nodes in some nodes , I can't show it .
code
import scipy
from edglist_utils import load_network_data
from scipy import sparse
network_file = 'photo'
adj, features, Y = load_network_data('graphsage/input/' + network_file + '.mat')
f2 = open("graphsage/cora_adj_list.txt", 'w')
f1 = open("graphsage/cora_create_list.txt", 'w')
# for i in range(2708):
# f2.write(str(i) + "\n" + str(adj[i]) + "\n\n")
# for part in adj[i]:
#
#
# part = str(part).replace(' (0, ', '')
# part = str(part).replace(') 1', '')
# part = str(part).replace(' : :\n', '')
# # list_str = list(str(part)) # Convert string to list
# # print(str(i)+","+part)
# quote_list = part.split('\n')
# for quote in quote_list:
# if (i < int(quote)) :
# f1.write(str(i) + "," + str(quote)+"\n")
# print(str(i) + "," + str(quote))
solution2
take ndarray And scipy.sparse.csc.csr_matrix Of each other
url
https://huwang.blog.csdn.net/article/details/84623786?spm=1001.2101.3001.6650.1&utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7Edefault-1-84623786-blog-83036442.pc_relevant_default&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7Edefault-1-84623786-blog-83036442.pc_relevant_default&utm_relevant_index=2
result
success
code
import scipy
from edglist_utils import load_network_data
from scipy import sparse
network_file = 'cs'
adj, features, Y = load_network_data('graphsage/input/' + network_file + '.mat')
f1 = open("graphsage/cs_create_list.txt", 'w')
my_matrix = scipy.sparse.csc_matrix(adj)
my_array = my_matrix.A
print(type(my_array))
print(len(my_array))
print(int(my_array[2][1]))
for i in range(len(my_array)):
for j in range(len(my_array)):
if int(my_array[i][j]) == 1 and i < j:
f1.write(str(i) + "," + str(j) + "\n")
边栏推荐
- Low CPU load and high loadavg processing method
- GCC [7] - compilation checks the declaration of functions, and link checks the definition bugs of functions
- Lick the dog until the last one has nothing (simple DP)
- Actf 2022 came to a successful conclusion, and 0ops team won the second consecutive championship!!
- LeetCode_格雷编码_中等_89.格雷编码
- map的使用(列表的数据赋值到表单,json逗号隔开显示赋值)
- Vmware虚拟机无法打开内核设备“\\.\Global\vmx86“的解决方法
- How can my Haskell program or library find its version number- How can my Haskell program or library find its version number?
- usb host 驱动 - UVC 掉包
- Intelligent supply chain management system solution for hardware and electromechanical industry: digital intelligent supply chain "creates new blood" for traditional industries
猜你喜欢

Sanmian ant financial successfully got the offer, and has experience in Android development agency recruitment and interview

全套教学资料,阿里快手拼多多等7家大厂Android面试真题
时钟轮在 RPC 中的应用

学习探索-使用伪元素清除浮动元素造成的高度坍塌
![打家劫舍III[后序遍历与回溯+动态规划]](/img/9b/e9eeed138e46afdeed340bf2629ee1.png)
打家劫舍III[后序遍历与回溯+动态规划]
![Fast power template for inverse element, the role of inverse element and example [the 20th summer competition of Shanghai University Programming League] permutation counting](/img/dd/c3f4a9c38b156e3a9b9adfd6253773.gif)
Fast power template for inverse element, the role of inverse element and example [the 20th summer competition of Shanghai University Programming League] permutation counting

Druid database connection pool details

理解 YOLOV1 第二篇 预测阶段 非极大值抑制(NMS)

An error occurs when installing MySQL: could not create or access the registry key needed for the

Cereals Mall - Distributed Advanced p129~p339 (end)
随机推荐
保证接口数据安全的10种方案
Excel 中VBA脚本的简单应用
121. 买卖股票的最佳时机
利用 clip-path 绘制不规则的图形
swagger2报错Illegal DefaultValue null for parameter type integer
Cereals Mall - Distributed Advanced p129~p339 (end)
Actf 2022 came to a successful conclusion, and 0ops team won the second consecutive championship!!
Unbalance balance (dynamic programming, DP)
Tensorflow2.0 self defined training method to solve function coefficients
Interview assault 63: how to remove duplication in MySQL?
MySQL information schema learning (II) -- InnoDB table
Dark horse -- redis
GCC [7] - compilation checks the declaration of functions, and link checks the definition bugs of functions
时钟轮在 RPC 中的应用
Synchronous development of business and application: strategic suggestions for application modernization
Teach you to learn JS prototype and prototype chain hand in hand, a tutorial that monkeys can understand
Solution of intelligent management platform for suppliers in hardware and electromechanical industry: optimize supply chain management and drive enterprise performance growth
How can my Haskell program or library find its version number- How can my Haskell program or library find its version number?
Druid database connection pool details
Take a look at how cabloyjs workflow engine implements activiti boundary events