Skip to main content

GL-Coarsener,一种基于图学习的粗化方法

项目描述

GL-粗磨机

GL-Coarsener 方法的 python 实现,如GL-Coarsener: A Graph representation learning framework to construction rough grid hierarchy for AMG solvers, arXiv:2011.09994中提出的。

如果您发现我们的代码或论文对您的研究有用,请考虑引用:

@misc{namazi2020glcoarsener,
      title={GL-Coarsener: A Graph representation learning framework to construct coarse grid hierarchy for AMG solvers}, 
      author={Reza Namazi and Arsham Zolanvari and Mahdi Sani and Seyed Amir Ali Ghafourian Ghahramani},
      year={2020},
      eprint={2011.09994},
      archivePrefix={arXiv},
      primaryClass={math.NA}
}

安装

pip install gl-coarsener

用法

导入包

from glcoarsener import Coarsener

输入

您应该使用要粗化的邻接矩阵构造一个Coarsener对象。输入必须是scipy sparse CSR matrix类型。

from scipy import sparse
adjacency_matrix = sparse.random(1000, 1000, format='csr')
coarsener = Coarsener(adjacency_matrix)

应用方法

prolongation_operator = coarsener.apply(
    dimensions=100,
    walk_length=20,
    num_walks=10,
    p=0.1,
    q=1,
    number_of_clusters=adjacency_matrix.shape[0] // 5,
    clustering_method='kmeans',
    workers=1
)

获取粗略(较小)的邻接矩阵

restriction_operator = prolongation_operator.transpose()
coarse_matrix = restriction_operator.dot(adjacency_matrix).dot(prolongation_operator)
print(coarse_matrix)

贡献

非常感谢任何贡献。如果你认为你可以改进这项工作,请打开一个拉取请求。

  1. 分叉项目
  2. 创建您的功能分支 ( git checkout -b feature/Improvement)
  3. 提交您的更改 ( git commit -m 'Add some Improvement')
  4. 推送到分支 ( git push origin feature/Improvement)
  5. 打开拉取请求

接触

如果您有任何问题,请随时与我联系:

项目详情


下载文件

下载适用于您平台的文件。如果您不确定要选择哪个,请了解有关安装包的更多信息。

源分布

gl-coarsener-2.0.0.tar.gz (4.6 kB 查看哈希)

已上传 source

内置分布

gl_coarsener-2.0.0-py3-none-any.whl (6.8 kB 查看哈希)

已上传 py3