Skip to main content

GL-Coarsener, a graph learning based coarsening method

Project description

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:

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gl-coarsener-2.0.0.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gl_coarsener-2.0.0-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

Details for the file gl-coarsener-2.0.0.tar.gz.

File metadata

  • Download URL: gl-coarsener-2.0.0.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for gl-coarsener-2.0.0.tar.gz
Algorithm Hash digest
SHA256 9146068fd08d8bd5d0da14f310e5cf5bd10dee5d6b2a1a77214566e6c95968db
MD5 905a1e43531146f8c1714de197f1bb52
BLAKE2b-256 3feb985cf2934b2de8ddccd432cd7fc86658f72b5cac3c9c304e9b40b1bdd268

See more details on using hashes here.

File details

Details for the file gl_coarsener-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: gl_coarsener-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 6.8 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for gl_coarsener-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 39f8454e3f82dddfd35d16928aa9452a7a2fe60e991e43fc0e7cbbb4d06c5b40
MD5 7925174ce133ae10eb2270389458369b
BLAKE2b-256 393b23897d55f1f4b9c0333591ce1b3813feac23bbdb1799de447eedc44c31ad

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page