Skip to main content

GL-Coarsener

A python implementation of GL-Coarsener method, as proposed in GL-Coarsener: A Graph representation learning framework to construct coarse grid hierarchy for AMG solvers, arXiv:2011.09994.

If you find our code or paper useful in your research, please consider citing:

@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}
}

Installation

pip install gl-coarsener

Usage

Import the package

from glcoarsener import Coarsener

Input

You should construct a Coarsener object with the adjacency matrix that you want to coarsen. The input must be of type scipy sparse CSR matrix.

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

Applying the method

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
)

Getting the coarse (smaller) adjacency matrix

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

Contributing

Any contribution is greatly appreciated. If you think you can improve this work, please open a pull request.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/Improvement)
  3. Commit your Changes (git commit -m 'Add some Improvement')
  4. Push to the Branch (git push origin feature/Improvement)
  5. Open a Pull Request

Contact

If you have any questions, please do not hesitate to contact me:

Metadata

Release files for gl-coarsener 2.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gl-coarsener 2.0.0
File Size Uploaded
gl-coarsener-2.0.0.tar.gz 4.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for gl-coarsener 2.0.0
File Interpreter ABI Platform
gl_coarsener-2.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 11.4 kB

Release files / gl-coarsener-2.0.0.tar.gz

Download URL gl-coarsener-2.0.0.tar.gz
Size 4.6 kB
Tags Source
SHA-256 checksum
How to use checksums
9146068fd08d8bd5d0da14f310e5cf5bd10dee5d6b2a1a77214566e6c95968db
BLAKE2b-256 checksum
How to use checksums
3feb985cf2934b2de8ddccd432cd7fc86658f72b5cac3c9c304e9b40b1bdd268
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.7

Release files / gl_coarsener-2.0.0-py3-none-any.whl

Download URL gl_coarsener-2.0.0-py3-none-any.whl
Size 6.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
39f8454e3f82dddfd35d16928aa9452a7a2fe60e991e43fc0e7cbbb4d06c5b40
BLAKE2b-256 checksum
How to use checksums
393b23897d55f1f4b9c0333591ce1b3813feac23bbdb1799de447eedc44c31ad
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.7

Release history Release notifications | RSS feed

This release

2.0.0 This release

2 release files

1.1

2 release files

1.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page