Simplificacion de grafos urbanos y analisis de criminalidad
Project description
ACJ: Urban Graph Acceleration & Simplification Framework
ACJ is a high-performance hybrid framework (C++/Python) designed for the semantic and topological simplification of large-scale urban networks. It safely decouples complex geometric operations from semantic data attributes, ensuring that metadata (e.g., speed limits, road names) survives massive graph reductions.
System Architecture
The core philosophy of ACJ relies on treating UrbanNetwork as an invariant Registry/Proxy. Heavy geometric simplifications are sent to a highly optimized C++ core using CGAL. The core returns the simplified topology alongside strict lineage maps, which Python then uses to reconstruct and resolve semantic collisions.
graph TD
subgraph Inputs ["Multimodal Inputs"]
A1[OSMnx]
A2[DataFrames]
A3[Shapefiles]
end
A1 -->|from_networkx| B
A2 -->|from_dataframe| B
A3 -->|Parsers| B
subgraph Python ["Python Layer"]
B[UrbanNetwork <br/> Registry/Proxy]
E[Semantic Resolution <br/> Metadata Fusion]
F[Metrics & Evaluator]
end
subgraph Cpp ["C++ Core (CGAL/pybind11)"]
C[Raw Topology <br/> V, E matrices]
D[Geometric & Topological <br/> Simplification Algorithms]
end
B -.->|Passes Topology| C
C --> D
D -.->|SimplificationResult <br/> Topology + Lineage Maps| E
B -.->|Passes Metadata| E
E -->|Resolved UrbanNetwork| F
Installation Guide
Quick Install (Recommended)
ACJ is officially published on PyPI and ships with pre-compiled wheels for Linux, macOS (Apple Silicon), and Windows. You do not need to compile any C++ code manually!
Simply run:
pip install acj
(Note: We recommend installing it within a Python virtual environment python -m venv venv)
Developer / From Source Installation
If you want to modify the library or the C++ core, you will need to build it from source.
Prerequisites: You need a system with C++17 support, CMake, and the following libraries:
- CGAL (Computational Geometry Algorithms Library)
- Boost
- pybind11
On Ubuntu/Debian:
sudo apt-get update
sudo apt-get install cmake libcgal-dev libboost-all-dev
On Arch Linux:
sudo pacman -S cmake cgal boost pybind11
Building the Package:
git clone https://github.com/CdeCasurpie/CS5351-acj.git
cd CS5351-acj
python -m venv venv
source venv/bin/activate
pip install -U pip setuptools wheel
pip install -e .
Quick Start (E2E Pipeline)
This demonstrates the end-to-end pipeline: extracting raw data, parsing, executing a highly optimized topological simplification, and calculating compression metrics.
import osmnx as ox
from acj import UrbanNetwork, ACJTopologicalEvaluator
from acj import CompressionRatioMetric, SemanticSpeedDistortionMetric
# 1. Ingest Data (Raw Graph)
G = ox.graph_from_place("Barranco, Lima, Peru", network_type="drive")
# 2. Parse into Multimodal Registry
network = UrbanNetwork.from_networkx(G)
print("Initial:", network)
# 3. Setup Metrics and Evaluator
metrics = [CompressionRatioMetric(), SemanticSpeedDistortionMetric()]
evaluator = ACJTopologicalEvaluator(network, metrics)
# 4. Evaluate (C++ Topo Simplification + Semantic Resolution)
results = evaluator.evaluate()
print("Results:", results)
print("Simplified:", evaluator.simplified_network)
Module Structure (API Reference)
acj.core (The Heart of the Framework)
This module acts as the central orchestrator for data decoupling.
UrbanNetwork: The fundamental data structure of the library. It stores raw network topologies in heavily optimized Pandas DataFrames alongside dictionaries of semantic metadata. Supports multimodal ingestion fromNetworkX,osmnx, or arbitrary DataFrames.resolve_semantics(): The pure Python metadata fusion engine. When a graph is collapsed by C++, this function takes the topological lineage map and automatically resolves semantic collisions (e.g., averaging max speeds or concatenating street names) to keep information loss at 0.
acj.algorithms (Python Wrappers & Indexing)
graph/minkowski: Wrappers for invoking our low-level C++ simplification procedures. Here you'll find interfaces for topological simplifications, geometric clustering, Minkowski-sum reductions, and more.MapIndex: An advanced spatial querying interface wrapping CGAL spatial trees, enabling fast nearest-neighbor point-to-graph assignments (essential for crime mapping or event correlation on large networks).
acj.data (Data Binding & IO)
SimplificationResult: The critical struct generated and bound directly from pybind11. It holds the newGraphDatatopology alongside.node_lineageand.edge_lineagedictionaries linking new entities back to their original IDs.GraphData: Internal lightweight wrapper handling node/edge validations before passing arrays down to C++.
acj.evaluation (Research & Metrics Engine)
BaseEvaluator/ACJTopologicalEvaluator: Automates the simplification lifecycle. These evaluators accept a rawUrbanNetwork, inject it into C++ for reduction, apply the semantic resolution layer, and systematically test the results against predefined metrics.CompressionRatioMetric/SemanticSpeedDistortionMetric: Pluggable metrics allowing researchers to quantitatively evaluate exactly how much data is compressed and what percentage of the semantic truth (like speed distributions) is distorted during network abstraction.
Authors
This framework was developed as part of a thesis research project by:
- Alejandro Calizaya
- Cesar Perales
- Jerimy Sandoval
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
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file acj-0.1.2.tar.gz.
File metadata
- Download URL: acj-0.1.2.tar.gz
- Upload date:
- Size: 53.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ccda76c834fc6c3e60881dd5c0b929ca3cf66042513ac3d1b9e1d7549fcfa83e
|
|
| MD5 |
c29dab6c46cc41d34be84013219283ae
|
|
| BLAKE2b-256 |
9bbd30a091c72de543666007e4c7c7e9013558601b9ec8046be42d91c7c20eba
|
File details
Details for the file acj-0.1.2-cp313-cp313-win_amd64.whl.
File metadata
- Download URL: acj-0.1.2-cp313-cp313-win_amd64.whl
- Upload date:
- Size: 1.2 MB
- Tags: CPython 3.13, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a8d8afce07e2ea64c44473cb2870294bf78bec25636bbc42a36848c73bbb699d
|
|
| MD5 |
a3e02e23e1f983d58e657dc7f4d412a5
|
|
| BLAKE2b-256 |
2dd8455b88351e55495dcec1251122643dec017e4120c424fdb1ebba2ea76099
|
File details
Details for the file acj-0.1.2-cp313-cp313-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: acj-0.1.2-cp313-cp313-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 1.1 MB
- Tags: CPython 3.13, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6a97f713c10ddc8d8b79132a173d8e50acfb9cc1d5fdc58997005572f8e8d6a3
|
|
| MD5 |
0c6fbb6d22322f80239aef07a460cfb3
|
|
| BLAKE2b-256 |
5f598f8f518827985f3b1f09a9721c817b77dd30fdf31ddd8c8023e03284ee84
|
File details
Details for the file acj-0.1.2-cp313-cp313-macosx_15_0_arm64.whl.
File metadata
- Download URL: acj-0.1.2-cp313-cp313-macosx_15_0_arm64.whl
- Upload date:
- Size: 919.2 kB
- Tags: CPython 3.13, macOS 15.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
157f45c68d402522c6c32108e9e20adb578fd94fe0bcc852574701c9f5f3f52a
|
|
| MD5 |
9e477b64f184be340c251ad26eb86c08
|
|
| BLAKE2b-256 |
5e8cac5bdb4e0cc24e5ef60de4fbd70d0302bf3ba83d53c9377918ff67ae38e5
|
File details
Details for the file acj-0.1.2-cp312-cp312-win_amd64.whl.
File metadata
- Download URL: acj-0.1.2-cp312-cp312-win_amd64.whl
- Upload date:
- Size: 1.2 MB
- Tags: CPython 3.12, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a049656741cd144e18a60a158fc0b1188c532f88345d895328e6773120b5374e
|
|
| MD5 |
6ff1913e79fa289cd2e1805750486cbb
|
|
| BLAKE2b-256 |
285c771f3fdfece59cc6599539f4894affc951d846ba8d16ddcb00e96e611b0b
|
File details
Details for the file acj-0.1.2-cp312-cp312-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: acj-0.1.2-cp312-cp312-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 1.1 MB
- Tags: CPython 3.12, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d8699b261cdbffa8476592e549a8d570044bd306af4905bef9b1434ff1f0ea7e
|
|
| MD5 |
ae752e19c3633ca0976dd39772208786
|
|
| BLAKE2b-256 |
ec211e307bbb1c716619562ed8dab44f244977d0d8f3370434e89d0f759f3f58
|
File details
Details for the file acj-0.1.2-cp312-cp312-macosx_15_0_arm64.whl.
File metadata
- Download URL: acj-0.1.2-cp312-cp312-macosx_15_0_arm64.whl
- Upload date:
- Size: 919.2 kB
- Tags: CPython 3.12, macOS 15.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2ac28d553867166da236382d2e6175a03da83b075842d8c4cc5ca0b6e79c86cf
|
|
| MD5 |
f71ecc9bb525b5422a7a09e8ddbf88bc
|
|
| BLAKE2b-256 |
4fb5accdb497658fa4742788a924fd21d766ed7817cd2813629340101dbe581a
|
File details
Details for the file acj-0.1.2-cp311-cp311-win_amd64.whl.
File metadata
- Download URL: acj-0.1.2-cp311-cp311-win_amd64.whl
- Upload date:
- Size: 1.2 MB
- Tags: CPython 3.11, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1b10cd94039519dbf0033adbbe661c2734735de1bc97712b23d1173d3bf8a84d
|
|
| MD5 |
eb9df6b54edd0fe8215fb6771c4f27c4
|
|
| BLAKE2b-256 |
a325aa2d03819682418cbffd43928887da425c794074fc8ab73c9a93275f7acd
|
File details
Details for the file acj-0.1.2-cp311-cp311-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: acj-0.1.2-cp311-cp311-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 1.1 MB
- Tags: CPython 3.11, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4f33bfe3f4ddab08208072c7b88dc6b0baee67d09f783ab63e532d946eb68294
|
|
| MD5 |
8cd54108ef60a6504af35b7b06126c8f
|
|
| BLAKE2b-256 |
e1a91a6fdaa77b690719186ff94086885919b383f5dd248130a103e2581bffa7
|
File details
Details for the file acj-0.1.2-cp311-cp311-macosx_15_0_arm64.whl.
File metadata
- Download URL: acj-0.1.2-cp311-cp311-macosx_15_0_arm64.whl
- Upload date:
- Size: 918.3 kB
- Tags: CPython 3.11, macOS 15.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4094ca6dbecc38b55efa52adda0b6bc2987b25e65fcbc551e269f4b96cfd3edd
|
|
| MD5 |
986f157b78c2a29f4a29ea680ff00181
|
|
| BLAKE2b-256 |
e345faa75280f2d8d72da887a1179af53372f4f9185aa62568d6d61b3f13df86
|
File details
Details for the file acj-0.1.2-cp310-cp310-win_amd64.whl.
File metadata
- Download URL: acj-0.1.2-cp310-cp310-win_amd64.whl
- Upload date:
- Size: 1.2 MB
- Tags: CPython 3.10, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
998f94b32047ed16c990cd16e843847f13ff5198bc849294b55bd7712e925d44
|
|
| MD5 |
e4c8f4ff3018d71b27a65dd3edc135c0
|
|
| BLAKE2b-256 |
117242ebcd3796d542bd93f73e417cd040531d64addb24fda8ceec44091818c1
|
File details
Details for the file acj-0.1.2-cp310-cp310-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: acj-0.1.2-cp310-cp310-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 1.1 MB
- Tags: CPython 3.10, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
da64f5bfe2e3cfee831ba0c8263b1870e1bb5c6c4686061cecfd98bc2cfcbd56
|
|
| MD5 |
5c9ea6d40338e335a15228fc56122180
|
|
| BLAKE2b-256 |
78feca810fcc3f260560d86c174432b43b9e60cbe349f22934961513346e6ed7
|
File details
Details for the file acj-0.1.2-cp310-cp310-macosx_15_0_arm64.whl.
File metadata
- Download URL: acj-0.1.2-cp310-cp310-macosx_15_0_arm64.whl
- Upload date:
- Size: 917.4 kB
- Tags: CPython 3.10, macOS 15.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b151f214b3a361fbf688008988c738b817dbf5c45cee5dc30505330343005af2
|
|
| MD5 |
29108212261de62ccee1062c2b6cb66b
|
|
| BLAKE2b-256 |
ac488bc691928e1406707159253a131da6041fb25e999b045d823dc6324e78dc
|