ADaptive-Structural-Fingerprint
ADaptive-Structural-Fingerprint copied to clipboard
Problems in the source code
In the code block below from utils_nhop_neighbours.py → load_data
# calculate n-hop neighbors
G = nx.DiGraph()
# inf = pickle.load(open('adj_citeseer.pkl', 'rb'))
inf = pickle.load(open("data/citeseer/ind.citeseer.graph", "rb"), encoding="latin1")
for i in range(len(inf)):
for j in range(len(inf[i])):
G.add_edge(i, inf[i][j], weight=1)
for i in range(3312):
for j in range(3312):
try:
rs = nx.astar_path_length \
(
G,
i,
j,
)
except nx.NetworkXNoPath:
rs = 0
if rs == 0:
length = 0
else:
# print(rs)
length = len(rs)
adj_delta[i][j] = length
Problem 1 len(G) is 3327 but in for loop to calculate shortest paths iterates in 3312 x 3312 range
Problem 2 nx.astar_path_length method returns the length of the shortest path between i and j but rs = nx.astar_path_length(G, i, j) value is used with length, length = len(rs), as if it is the shortest path, which raises error
TypeError: object of type 'int' has no len()
Problem 3 The following files are missing: ri_index_c_0.5_citeseer_highorder_1_x_abs.pkl ri_all_c_0.5_citeseer_highorder_1_x_abs.pkl
Could you please upload the correct version of the source code with much more explanation? Thanks.
Have you got complete data?