Networkex is licensed under the Apache License 2.0 (LICENSE). NOTICE holds the attribution notices that must accompany it. This file describes the third-party work in detail, in three groups:
- (a) code in the Hex package, derived from spaghetti and CPython;
- (b) the Rust crates linked into the precompiled NIF libraries;
- (c) data in the source repository only, which is not part of the Hex package.
License texts
| File | Text | Covers |
|---|---|---|
LICENSE | Apache License 2.0 | networkex |
LICENSES/BSD-3-Clause-spaghetti.txt | spaghetti's BSD 3-Clause License, verbatim from spaghetti 1.7.6 (LICENSE.txt) | the code derived from spaghetti, (a) |
LICENSES/PSF-2.0.txt | Python Software Foundation License Version 2, verbatim from CPython 3.13 (LICENSE) | native/networkex_core/src/hypot.rs, (a) |
LICENSES/BSD-3-Clause-libpysal.txt | libpysal's BSD 3-Clause License, verbatim from libpysal 4.15.1 (LICENSE.txt) | the libpysal example data, (c) |
The MIT and ISC texts of the Rust crates are reproduced in (b). The Hex package ships LICENSE,
NOTICE, this file and the LICENSES directory. Every GitHub release attaches LICENSE,
NOTICE, this file, PSF-2.0.txt and BSD-3-Clause-spaghetti.txt beside the precompiled NIF
libraries.
(a) Code in the Hex package
spaghetti
Networkex is a port of spaghetti, PySAL's library for spatial analysis on networks, and follows its behaviour and the published literature it cites (Okabe and Sugihara, 2012, Spatial Analysis Along Networks). To reproduce spaghetti's results exactly, portions of its source code (spaghetti 1.7.6) were translated into Rust and Elixir. These functions are derived from it; each carries a comment that names its spaghetti source:
| Networkex | spaghetti 1.7.6 |
|---|---|
native/networkex_core/src/network.rs: round_vertex | Network._round_sig (spaghetti/network.py) |
native/networkex_core/src/network.rs: build_with | the vertex and arc loop of Network._extractnetwork |
native/networkex_core/src/network.rs: components | the component attributes of Network.identify_components (the labelling itself is a union-find) |
native/networkex_core/src/network.rs: extract_graph | Network.extractgraph, _yield_napts, _evaluate_napts, _yieldneighbor |
native/networkex_core/src/distances.rs: point_link | squared_distance_point_link (spaghetti/util.py) |
native/networkex_core/src/distances.rs: all_neighbor_distances | Network.allneighbordistances |
native/networkex_core/src/distances.rs: shortest_paths | Network.allneighbordistances with gen_tree=True |
native/networkex_core/src/distances.rs: route, drop_joints | Network.shortest_paths |
native/networkex_core/src/kfunction.rs: point_along | Network._newpoint_coords |
native/networkex_core/src/kfunction.rs: simulate | Network.simulate_observations |
native/networkex_core/src/kfunction.rs: curve, global_auto_k | global_auto_k, GlobalAutoK.computeobserved and computepermutations, FuncBase.setbounds and computeenvelope (spaghetti/analysis.py) |
native/networkex_core/src/utilities.rs: split_arcs | Network.split_arcs |
lib/networkex/network.ex: regular_lattice/3, chains/5 | regular_lattice (spaghetti/network.py) and build_chains (spaghetti/util.py) |
The rest of Networkex reimplements spaghetti's documented behaviour, with its own algorithms and
data structures, and is checked against spaghetti's outputs. The test fixtures under
test/reference/fixtures are generated by running spaghetti and libpysal (dev-time only, see
test/reference/README.md); they contain numerical outputs, not code, and the fixtures computed
on the geodanet data are derived from that data (see (c)). The fixtures are not part of the Hex
package.
The networkex_core code, including these functions, is also compiled into the precompiled NIF
libraries.
Copyright 2017 PySAL-spaghetti Developersspaghetti's BSD 3-Clause License, as in LICENSES/BSD-3-Clause-spaghetti.txt:
Copyright 2017 PySAL-spaghetti Developers
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.CPython (networkex_core)
native/networkex_core/src/hypot.rs ports the algorithm of CPython's math.hypot (vector_norm
in Modules/mathmodule.c, as in CPython 3.13), so segment lengths match libpysal's bit for bit.
It is part of the Hex package and of the precompiled NIF libraries.
Copyright (c) 2001-2024 Python Software Foundation; All Rights ReservedSummary of the changes made to CPython's code (clause 3 of the license below):
- translated from C to Rust;
- reduced to two arguments,
math.hypot(x, y): the loop over a vector of any length and the shortcut for fewer than two values are gone, and the infinity and NaN checks ofvector_normrun on the two values before the norm; frexpandldexpare replaced by exact operations on the bits of the IEEE 754 double;- the error-free product always uses a fused multiply-add (
f64::mul_add); CPython's Veltkamp-Dekker alternative for platforms without a reliable fma is not ported; - the rescaling of subnormal inputs by
DBL_MIN(f64::MIN_POSITIVE) and every other arithmetic step are kept in CPython's order, so results are bit for bit those ofmath.hypot; - unit tests and a comparison with CPython's results (
test/reference/fixtures/hypot) are added.
The Python Software Foundation License Version 2, verbatim from CPython 3.13 (also in
LICENSES/PSF-2.0.txt):
PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2
--------------------------------------------
1. This LICENSE AGREEMENT is between the Python Software Foundation
("PSF"), and the Individual or Organization ("Licensee") accessing and
otherwise using this software ("Python") in source or binary form and
its associated documentation.
2. Subject to the terms and conditions of this License Agreement, PSF hereby
grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce,
analyze, test, perform and/or display publicly, prepare derivative works,
distribute, and otherwise use Python alone or in any derivative version,
provided, however, that PSF's License Agreement and PSF's notice of copyright,
i.e., "Copyright (c) 2001-2024 Python Software Foundation; All Rights Reserved"
are retained in Python alone or in any derivative version prepared by Licensee.
3. In the event Licensee prepares a derivative work that is based on
or incorporates Python or any part thereof, and wants to make
the derivative work available to others as provided herein, then
Licensee hereby agrees to include in any such work a brief summary of
the changes made to Python.
4. PSF is making Python available to Licensee on an "AS IS"
basis. PSF MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, PSF MAKES NO AND
DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS
FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON WILL NOT
INFRINGE ANY THIRD PARTY RIGHTS.
5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON
FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS
A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON,
OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
6. This License Agreement will automatically terminate upon a material
breach of its terms and conditions.
7. Nothing in this License Agreement shall be deemed to create any
relationship of agency, partnership, or joint venture between PSF and
Licensee. This License Agreement does not grant permission to use PSF
trademarks or trade name in a trademark sense to endorse or promote
products or services of Licensee, or any third party.
8. By copying, installing or otherwise using Python, Licensee
agrees to be bound by the terms and conditions of this License
Agreement.(b) Rust crates in the precompiled NIF libraries
The precompiled NIF libraries that Networkex downloads from its GitHub releases are built from
the networkex_native crate. They contain the networkex_core code of (a) and statically link
the Rust crates below and the Rust standard library.
The normal (non-build, non-proc-macro) dependencies of networkex_native, as resolved by
Cargo.lock. Crates offered under a choice of licenses are used under the one in the
"Used under" column.
| Crate | Version | Declared license | Used under | Targets |
|---|---|---|---|---|
| networkex_native | 0.1.0 | Apache-2.0 | Apache-2.0 | all |
| networkex_core | 0.1.0 | Apache-2.0 AND PSF-2.0 AND BSD-3-Clause | all three, see (a) | all |
| byteorder | 1.5.0 | Unlicense OR MIT | MIT | all |
| cfg-if | 1.0.5 | MIT OR Apache-2.0 | Apache-2.0 | macOS |
| geo-traits | 0.3.0 | MIT OR Apache-2.0 | Apache-2.0 | all |
| geo-types | 0.7.20 | MIT OR Apache-2.0 | Apache-2.0 | all |
| inventory | 0.3.25 | MIT OR Apache-2.0 | Apache-2.0 | all |
| libc | 0.2.191 | MIT OR Apache-2.0 | Apache-2.0 | macOS |
| libloading | 0.9.0 | ISC | ISC | macOS |
| libm | 0.2.16 | MIT | MIT | all |
| num-traits | 0.2.19 | MIT OR Apache-2.0 | Apache-2.0 | all |
| num_enum | 0.7.6 | BSD-3-Clause OR MIT OR Apache-2.0 | Apache-2.0 | all |
| rustler | 0.39.0 | MIT/Apache-2.0 | Apache-2.0 | all |
| thiserror | 1.0.69 | MIT OR Apache-2.0 | Apache-2.0 | all |
| thiserror | 2.0.21 | MIT OR Apache-2.0 | Apache-2.0 | all |
| wkb | 0.9.3 | MIT OR Apache-2.0 | Apache-2.0 | all |
"macOS" means aarch64-apple-darwin and x86_64-apple-darwin only; "all" means the six
targets of the precompiled NIFs. Procedural-macro crates (rustler_codegen, num_enum_derive,
thiserror-impl, serde_derive, rustversion) run at compile time and are not part of the
libraries.
The precompiled NIF libraries also include the Rust standard library, which is licensed under
MIT OR Apache-2.0 and used under Apache-2.0. Its own third-party components are listed in the
COPYRIGHT file of the Rust repository, under the tag of
the Rust release that built the libraries. The release workflow builds with the current stable
Rust, not a pinned version; the toolchain step of each build job prints that version in the
workflow log. No C library is linked statically: the musl build links musl dynamically (see
.cargo/config.toml).
License texts
The Apache License 2.0 is in LICENSE. None of the crates used under it ships a
NOTICE file. The MIT and ISC crates need their notices reproduced; they follow. The texts for
the code of (a) are given there.
byteorder (MIT)
Copyright (c) 2015 Andrew Gallant
libm (MIT)
From the crate's LICENSE.txt:
This Rust library contains the following copyrights:
Copyright (c) 2018 Jorge Aparicio
Portions of this software are derived from third-party works licensed under
terms compatible with the above MIT license:
* musl libc https://www.musl-libc.org/. This library contains the following
copyright:
Copyright © 2005-2020 Rich Felker, et al.
* The CORE-MATH project https://core-math.gitlabpages.inria.fr/. CORE-MATH
routines are available under the MIT license on a per-file basis.
The musl libc COPYRIGHT file also includes the following notice relevant to
math portions of the library:
------------------------------------------------------------------------------
Much of the math library code (src/math/* and src/complex/*) is
Copyright © 1993,2004 Sun Microsystems or
Copyright © 2003-2011 David Schultz or
Copyright © 2003-2009 Steven G. Kargl or
Copyright © 2003-2009 Bruce D. Evans or
Copyright © 2008 Stephen L. Moshier or
Copyright © 2017-2018 Arm Limited
and labelled as such in comments in the individual source files. All
have been licensed under extremely permissive terms.
------------------------------------------------------------------------------
Copyright notices are retained in src/* files where relevant.MIT License (byteorder, libm)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.libloading (ISC)
Copyright © 2015, Simonas Kazlauskas
Permission to use, copy, modify, and/or distribute this software for any purpose with or without
fee is hereby granted, provided that the above copyright notice and this permission notice appear
in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
THIS SOFTWARE.Regenerating this list
Update the table whenever Cargo.lock changes, before a release is tagged. Cargo prints the
linked crates and their declared licenses for each target (no other tool is needed):
for target in aarch64-apple-darwin x86_64-apple-darwin aarch64-unknown-linux-gnu \
x86_64-unknown-linux-gnu x86_64-unknown-linux-musl x86_64-pc-windows-msvc; do
echo "== $target"
cargo tree -p networkex_native -e normal,no-proc-macro --target "$target" \
--prefix none --format "{p} | {l}" --locked | sort -u
done
Copyright notices come from each crate's license files, which Cargo unpacks under
~/.cargo/registry/src/ (cargo metadata --locked --format-version 1 gives each crate's
manifest_path).
(c) Data in the repository only
None of the files below is part of the Hex package: they are read by the fixture generators and the notebooks of the source repository.
libpysal example data
These files are byte-for-byte copies of libpysal 4.15.1 example datasets
(https://github.com/pysal/libpysal, libpysal/examples):
test/reference/dataandnotebooks/data/geodanet: thegeodanetdataset ("Datasets from GeoDaNet for network analysis"), streets, crimes and schools of Tempe, Arizona, as used in the spaghetti tutorials;notebooks/data/snow: thesnow_mapsdataset ("Public water pumps and Cholera deaths in London 1854 (John Snow's Cholera Map)"). libpysal cites Snow, J. (1849), On the Mode of Communication of Cholera, and names no digitiser.
Each directory holds a subset of the upstream directory. Left out are the upstream README.md
files (their content is summarised here and in each directory's README), the spatial index files
(.sbn and .sbx) of every layer, and crimes.shp.xml of geodanet, an unfilled metadata
template whose origin and constraint fields hold only placeholders (for example "REQUIRED: The
name of an organization or individual that developed the data set."). The streets layer of
geodanet and the snow_maps layers ship no metadata file upstream.
Copyright (c) 2007-, PySAL Developers
All rights reserved.Redistributed under libpysal's BSD 3-Clause License, reproduced in
LICENSES/BSD-3-Clause-libpysal.txt.
The geodanet schools layer
The schools layer carries its own metadata, schools.shp.xml, a byte-for-byte copy that sits next
to each copy of the layer (test/reference/data and notebooks/data/geodanet). It states:
- title: "ADEQ_AZ_SCHOOLS_2008" (the FGDC citation gives "SCHOOLS_EVERYTHING_8_7_08", published "August 14, 2007", edition "Schools 8-14-2007");
- origin: "Arizona Department of Environmental Quality, Arizona Department of Health Services";
- credit: "This data set has been created in collaboration with the Arizona Department of Education, Arizona Department of Health Services, Arizona State Land Department and the Arizona State Cartographers Office."
- access constraint: "Access to these data are allowed for non-commercial applications without charge. Commercial uses require payment."
- use constraint: a disclaimer by the Arizona Department of Environmental Quality (ADEQ), which begins "The Arizona Department of Environmental Quality and others have compiled this data as a service to our customers using information from various sources." and states that "All data are provided "as is" and may contain errors."; the full text is in the file.
The Apache License 2.0 of Networkex does not cover this layer. libpysal redistributes it under its BSD 3-Clause License, and the metadata states the access constraint above.
OpenStreetMap data
notebooks/data/osm_tempe holds OpenStreetMap data, © OpenStreetMap contributors, available
under the Open Database License (ODbL 1.0, https://opendatacommons.org/licenses/odbl/); see
https://www.openstreetmap.org/copyright and notebooks/data/osm_tempe/README.md.