Skip to main content

Some tools for manipulating nearest-neighbors graphs defined on regular grids

Project description

Grid-graph (fork)

About this fork

The original code in available in this repository: https://gitlab.com/1a7r0ch3/grid-graph.

This a fork for python packaging purposes.

Please post issues in this repos only if you are sure your problem is related to the packaging... and please post issue on the upstream repository only if you are sure your problem is not related to the packaging.

Below, the original README.

Original README

Some tools for manipulating nearest-neighbors graphs defined on regular grids

C++ routines.
Parallelization with OpenMP.
Mex interfaces for GNU Octave or Matlab.
Extension module for Python.

A grid graph in dimension D is defined by the following parameters:

  • D - the number of dimensions

  • shape - array of length D, giving the grid size in each dimension

  • connectivity - defines the neighboring relationship;
    corresponds to the square of the maximum Euclidean distance between two neighbors; if less than 4, it defines the number of coordinates allowed to simultaneously vary (+1 or -1) to define a neighbor; (in that case, each level ℓ of connectivity in dimension D adds CD ⨯ 2 neighbors).
    Corresponding number of neighbors for D = 2 and 3:

    connectivity    1    2    3
    2D 4 8 (8)
    3D 6 18 26

    Note that a connectivity of 4 or more includes neighbors whose coordinates might differ by 2 or more from the coordinates of the considered vertex. In that sense, in dimension 4 or more, including all immediately surrounding vertices (that is, all vertices for which each coordinate differ by 1 or less) would then also include vertices from a more distant surround: the neighbor v + (2, 0, 0, 0) is at the same distance as the neighbor v + (1, 1, 1, 1).

A graph with V vertices and E edges is represented either as edge list (array of E edges given as ordered pair of vertices), or as forward-star, where edges are numbered (from 0 to E − 1) so that all edges originating from a same vertex are consecutive, and represented by the following parameters:

  • first_edge - array of length V + 1, indicating for each vertex, the first edge starting from the vertex (or, if there are none, starting from the next vertex); the last value is always the total number of edges
  • adj_vertices - array of length E, indicating for each edge, its ending vertex

Vertices of the grid are indexed in column-major order, that is indices increase first along the first dimension specified in the 'shape' array (in the usual convention in 2D, this corresponds to columns), and then along the second dimension, and so on up to the last dimension. Indexing in row-major order (indices increase first along the last dimension and so on up to the first) can be obtained by simply reverting the order of the grid dimensions in the shape array (in 2D, this amounts to transposition).

Work possibly in parallel with OpenMP API

Directory tree

.   
├── include/      C++ headers, with some doc  
├── octave/       GNU Octave or Matlab code  
│   ├── doc/      some documentation  
│   └── mex/      MEX C++ interfaces
├── python/       Python code  
│   └── cpython/  C Python interface  
└── src/          C++ sources  

C++ documentation

Requires C++11.
Be sure to have OpenMP enabled with your compiler to enjoy parallelization. Note that, as of 2020, MSVC still does not support OpenMP 3.0 (published in 2008); consider switching to a decent compiler.

The C++ classes are documented within the corresponding headers in include/.

Python extension module

Requires numpy package.
Requires numpy package.
See the script setup.py for compiling modules with setuptools; it can be run simply by using pip e.g. python -m pip install .. pre compiled binaries for Windows and Linux will soon be available on `PyPI

Once compiled, see the documentation with the help() python utility.

GNU Octave or Matlab

See the script compile_grid_graph_mex.m for typical compilation commands; it can be run directly from the GNU Octave interpreter, but Matlab users must set compilation flags directly on the command line CXXFLAGS = ... and LDFLAGS = ....

Extensive documentation of the MEX interfaces can be found within dedicated .m files in octave/doc/.

References and license

This software is under the GPLv3 license.

Hugo Raguet 2019, 2020

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

pygrid_graph-0.0.4-cp313-cp313-win_amd64.whl (43.5 kB view details)

Uploaded CPython 3.13Windows x86-64

pygrid_graph-0.0.4-cp313-cp313-musllinux_1_1_x86_64.whl (718.9 kB view details)

Uploaded CPython 3.13musllinux: musl 1.1+ x86-64

pygrid_graph-0.0.4-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (161.6 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

pygrid_graph-0.0.4-cp313-cp313-macosx_14_0_arm64.whl (287.3 kB view details)

Uploaded CPython 3.13macOS 14.0+ ARM64

pygrid_graph-0.0.4-cp312-cp312-win_amd64.whl (43.4 kB view details)

Uploaded CPython 3.12Windows x86-64

pygrid_graph-0.0.4-cp312-cp312-musllinux_1_1_x86_64.whl (721.2 kB view details)

Uploaded CPython 3.12musllinux: musl 1.1+ x86-64

pygrid_graph-0.0.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (162.6 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

pygrid_graph-0.0.4-cp312-cp312-macosx_14_0_arm64.whl (287.1 kB view details)

Uploaded CPython 3.12macOS 14.0+ ARM64

pygrid_graph-0.0.4-cp311-cp311-win_amd64.whl (43.3 kB view details)

Uploaded CPython 3.11Windows x86-64

pygrid_graph-0.0.4-cp311-cp311-musllinux_1_1_x86_64.whl (721.6 kB view details)

Uploaded CPython 3.11musllinux: musl 1.1+ x86-64

pygrid_graph-0.0.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (162.4 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

pygrid_graph-0.0.4-cp311-cp311-macosx_14_0_arm64.whl (287.0 kB view details)

Uploaded CPython 3.11macOS 14.0+ ARM64

pygrid_graph-0.0.4-cp310-cp310-win_amd64.whl (43.3 kB view details)

Uploaded CPython 3.10Windows x86-64

pygrid_graph-0.0.4-cp310-cp310-musllinux_1_1_x86_64.whl (720.5 kB view details)

Uploaded CPython 3.10musllinux: musl 1.1+ x86-64

pygrid_graph-0.0.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (162.2 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

pygrid_graph-0.0.4-cp310-cp310-macosx_14_0_arm64.whl (287.0 kB view details)

Uploaded CPython 3.10macOS 14.0+ ARM64

File details

Details for the file pygrid_graph-0.0.4-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for pygrid_graph-0.0.4-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 87d3cf4a2d8c895141e5b92ce83a424a805e5d4917d0f5fbcdb91d0622338b81
MD5 ac3bb18fbfd59c619c3d8055f7350f6d
BLAKE2b-256 8e3b0887a3a76a73627b881636141eaf16d61373cbae65f6378150e37937f13f

See more details on using hashes here.

File details

Details for the file pygrid_graph-0.0.4-cp313-cp313-musllinux_1_1_x86_64.whl.

File metadata

File hashes

Hashes for pygrid_graph-0.0.4-cp313-cp313-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 6064a21c709b114ab6429ba563efb44da172824abb777db54b44382c6f2ce835
MD5 f96efbaabb786a83177303956d1522ba
BLAKE2b-256 709e4d0158bcaf4a33e9bff63b628baf277e1e8ea442de07687f1b3cbc353878

See more details on using hashes here.

File details

Details for the file pygrid_graph-0.0.4-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pygrid_graph-0.0.4-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 56cd9691692b2c5541b2318f6d5a3771849e529aadcbe514c6b249f00918c755
MD5 7f2a31d2f4791c31be6c8921bf750112
BLAKE2b-256 b60daf02ca49decc1008ae63472095b2d6e504e589aad6dee8a59c203dcadb7f

See more details on using hashes here.

File details

Details for the file pygrid_graph-0.0.4-cp313-cp313-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for pygrid_graph-0.0.4-cp313-cp313-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 a3e84bf2203f94c942ec37c79056a46a2945d193f9b65d297abd62ec66009225
MD5 fa2e234ba086b6ea932d87adbd4af22e
BLAKE2b-256 57e2fa67cc697f61a2342c36f6a406141f727ade7bfc392ba3ea572a480a365a

See more details on using hashes here.

File details

Details for the file pygrid_graph-0.0.4-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pygrid_graph-0.0.4-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 9042709424c3cbdf947908761b37879be742e254a155c9638b492f94881049f0
MD5 0017048b21f94607f576cbcd942bf86c
BLAKE2b-256 7077784475be62a344fd7a3eb87274c3a5c1fa1402ab186ab92c749308eac773

See more details on using hashes here.

File details

Details for the file pygrid_graph-0.0.4-cp312-cp312-musllinux_1_1_x86_64.whl.

File metadata

File hashes

Hashes for pygrid_graph-0.0.4-cp312-cp312-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 afd69f8c9ea641fc9933a5443634d01c2070962443dba9e797aa301a7f09c1c1
MD5 59587998a7ab158dce2adc58b7bbbba6
BLAKE2b-256 edec1e58dfc5102c96c7e88b0679d6a244b8789da929557b01c813fe80f6fa59

See more details on using hashes here.

File details

Details for the file pygrid_graph-0.0.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pygrid_graph-0.0.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2aadc1cb2f20e87eb17d1bd65ce601082d9666d04837ae17ebb94106dd64ca7c
MD5 25c2ba4ca8e3b8f1c5a4eab1772b06ad
BLAKE2b-256 e7d7b4f32a5a8d2a3b2d76f294ba7220cafbda9977e8080ba4b901ddba6edf6d

See more details on using hashes here.

File details

Details for the file pygrid_graph-0.0.4-cp312-cp312-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for pygrid_graph-0.0.4-cp312-cp312-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 ec1dedf9c14a9cbb65dd530f988213e5c8b297fbf2b3af5352e5aed185ae6bce
MD5 409d0a241eb87ca37ef04f63c8abff42
BLAKE2b-256 f08b86e0afcc70344ce73e53ad6697578255649064d0fa745c9b09a71230dd20

See more details on using hashes here.

File details

Details for the file pygrid_graph-0.0.4-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pygrid_graph-0.0.4-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 db860cc88f67fbc14ffb679720ff9c9d49d72ce377f6e9b651878bf892bf8ece
MD5 63a7755520eace6e9df023174bc2335c
BLAKE2b-256 76546037bcfda7d0e84457bce22fccfceba032d43c9e3c8e475f7ab8f3c52437

See more details on using hashes here.

File details

Details for the file pygrid_graph-0.0.4-cp311-cp311-musllinux_1_1_x86_64.whl.

File metadata

File hashes

Hashes for pygrid_graph-0.0.4-cp311-cp311-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 2c62b2fd3b67dab1d135adbf777128249dc1dca765787a8d29180440a8039ec0
MD5 738bc660ddf45ca3a535a6c5b003e5cb
BLAKE2b-256 c5a5ad33425d9a87985f5e0e1cbebc1de1d81a2803b1b223248cf58b8447992a

See more details on using hashes here.

File details

Details for the file pygrid_graph-0.0.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pygrid_graph-0.0.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 bb0694af2993921ce2346a6876967f1a44343e99b0dde6896b7f8dcfe679eed0
MD5 2a1e21ad1a19f83bcbfed5b9ed289b3b
BLAKE2b-256 6314d3de3cad691c1e34a45396daa6fac6b7e29d87011227ebcdef534ca4293b

See more details on using hashes here.

File details

Details for the file pygrid_graph-0.0.4-cp311-cp311-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for pygrid_graph-0.0.4-cp311-cp311-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 487bcbf9cfea546aa457a73aebf53835b0399dc6dce5c329667c0fb1f557ffd6
MD5 6242b4f9e9db0d49edfcc943814ad3a8
BLAKE2b-256 8252644c71e3b5247e7539b2a3e23323d7d5d15494e7691464b1d20b562e5a44

See more details on using hashes here.

File details

Details for the file pygrid_graph-0.0.4-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pygrid_graph-0.0.4-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 d8e6d41b34146c509f1a437e733735409315488144f2b758d7290a54c9b8e295
MD5 cbffa73093b7ba2eb924b64a3f293dcf
BLAKE2b-256 8aef36a3df95a16dcc06038be0b4c1ef06cbef682ac2404a76c626db39bf61aa

See more details on using hashes here.

File details

Details for the file pygrid_graph-0.0.4-cp310-cp310-musllinux_1_1_x86_64.whl.

File metadata

File hashes

Hashes for pygrid_graph-0.0.4-cp310-cp310-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 37a926f2b4add2cbadbd192916f0d75cc5319442d1b4a8c00d656cf4fc36c9d5
MD5 ca970d77325bf1faeef4dd267678289b
BLAKE2b-256 d9ed38fa0f59dfb42157e9a0575fc273a1c5cad02a9d3854d5d6b4d8dbf88641

See more details on using hashes here.

File details

Details for the file pygrid_graph-0.0.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pygrid_graph-0.0.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5e0ff05391ffb2a104928f356213f6914cf717449c122e5f2da598bf4323c702
MD5 ec3b3a188d11af20daed223b2cfe20d7
BLAKE2b-256 71107522c6fd8977102d290ae7b16c26d401dbd96689fb9e90596e6b2c9d933a

See more details on using hashes here.

File details

Details for the file pygrid_graph-0.0.4-cp310-cp310-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for pygrid_graph-0.0.4-cp310-cp310-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 361a0ad702631562b7ca07b0715d5ce3c3a3f3bf0a3f3d81a105be08f3326281
MD5 2863b5059f3887d3fffbff46ac93a1a7
BLAKE2b-256 23423f6ec027bf7fe060bf059f1cc036cba658e80db49e2ed8877e8139db1a08

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