THUDM / HGB

Revisiting, benchmarking, and refining Heterogeneous Graph Neural Networks.
305 stars 47 forks source link

How to get this format data(sparse matrix)? #38

Closed zzyzeyuan closed 1 year ago

zzyzeyuan commented 1 year ago

Hi, I noticed that adjM in your code is a csr_matrix, like this:

  (0, 6421)     1.0
  (0, 10514)    1.0
  (1, 6422)     1.0
  (1, 6423)     1.0
  (1, 6446)     1.0
  (1, 6488)     1.0
  (1, 6518)     1.0
  (1, 6520)     1.0
  (1, 6532)     1.0
  (1, 6539)     1.0
  (1, 9481)     1.0
  (1, 10301)    1.0
  (2, 6581)     1.0
  (2, 13859)    1.0
  (2, 14411)    1.0

But it is not corresponding to the edge types. Now I want to obtain data in the following format :

  (0, 1)    1
  (1, 0)    2
  (1, 2)    3
  (2, 2)    4

[1,2,3,4] in the right side represent different edge types.

Based on your code, is there a good way to get this data format?