GraphZoom
GraphZoom copied to clipboard
How to generate reduction_results/Mapping.mtx for a new dataset?
Dear Dr. Zhang,
I am interested in your algorithm, and running the code in my experiment. For a new dataset, how can I generate new Mapping.mtx in the directory of reduction_results? graphzoom.py just calls for mapping_path = "{}Mapping.mtx".format(reduce_results), and I cannot find how to generate in graphzoom.py and utils.py. No Mapping.mtx, the code cannot run successfully.
I would appreciate it very much if you could help me.
Thanks Wei
Hi Wei,
Thanks for your interest! The "Mapping.mtx" file will be automatically obtained after running "lamg" coarsening: https://github.com/cornell-zhang/GraphZoom/blob/5156f86fa22efa853e864553de4225a9122d8062/graphzoom/graphzoom.py#L123-L124 Please refer to this line about how we generate the mapping matrix: https://github.com/cornell-zhang/GraphZoom/blob/5156f86fa22efa853e864553de4225a9122d8062/mat_coarsen/LamgSetup.m#L61
For a new dataset, all you need to do is to convert the new dataset into the same format as "cora" dataset under GraphZoom/graphzoom/dataset/. Then you should be able to run embedding methods on the new dataset. Feel free to let me know if you have any questions.
Thanks, Chenhui
Hi Wei,
Thanks for your interest! The "Mapping.mtx" file will be automatically obtained after running "lamg" coarsening:
https://github.com/cornell-zhang/GraphZoom/blob/5156f86fa22efa853e864553de4225a9122d8062/graphzoom/graphzoom.py#L123-L124
Please refer to this line about how we generate the mapping matrix: https://github.com/cornell-zhang/GraphZoom/blob/5156f86fa22efa853e864553de4225a9122d8062/mat_coarsen/LamgSetup.m#L61
For a new dataset, all you need to do is to convert the new dataset into the same format as "cora" dataset under GraphZoom/graphzoom/dataset/. Then you should be able to run embedding methods on the new dataset. Feel free to let me know if you have any questions.
Thanks, Chenhui
谢谢你的回复。但是很奇怪,我的代码没有自动生成 Mapping.mtx,仍然使用默认的文件,它表示cora数据的相关信息;如果我删掉reduction_results/中的默认文件,代码也不会生成。我也不知道问题出在哪。
由于我采用 fusion 模式,因此代码本应该通过 Lines 23-24行来生成Mapping.mtx
请问能否提供一些宝贵建议?谢谢!
Hi Wei,
Are you using "lamg" coarsening? If so, have you successfully finished the lamg coarsening (there should be a table showing coarsening details printed out)? It would be more helpful if you can share with me the whole error message.
Hi Wei,
Are you using "lamg" coarsening? If so, have you successfully finished the lamg coarsening (there should be a table showing coarsening details printed out)? It would be more helpful if you can share with me the whole error message.

The code still employs the incorrect Mapping.mtx, and does not generate a new Mapping.mtx for a new dataset.
Thanks Wei
Hi Wei,
The error message shows that the lamg coarsening is not successfully finished (reduction ratio is too small). Thus, the coarsening process is stopped and cannot generate the Mapping.mtx file. What reduction/coarsening ratio are you using? Can you try larger ratio?
Hi Wei,
The error message shows that the lamg coarsening is not successfully finished (reduction ratio is too small). Thus, the coarsening process is stopped and cannot generate the Mapping.mtx file. What reduction/coarsening ratio are you using? Can you try larger ratio?
Honestly, I have tried many values of reduce_ratio, e.g., 1000, and it till reports the same error.
Thanks Wei
I see. We noticed that the "lamg" coarsening would crash on a few datasets. This is because the lamg solver (our matlab code) has some predefined hyperparameters that may be improper for those datasets and thus the coarsening will not be executed. Can you try "simple" coarsening instead? It would be appreciated if you can also provide your dataset with us so that we can help to check the lamg issue later.
Hi Wei, The error message shows that the lamg coarsening is not successfully finished (reduction ratio is too small). Thus, the coarsening process is stopped and cannot generate the Mapping.mtx file. What reduction/coarsening ratio are you using? Can you try larger ratio?
Honestly, I have tried many values of reduce_ratio, e.g., 1000, and it till reports the same error.
Thanks Wei
I have attached one dataset. Please notice that, this is a complement graph of blog network, so it is a very dense network. The average degree is above 2500. I don't know whether failure is related to this factor, because I ran on the original sparse network successfully.
Thanks Wei