The routing API calculates the shortest walking path between two campus waypoints. Internally,Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Jcofles/Proyecto-web/llms.txt
Use this file to discover all available pages before exploring further.
NodoController::ruta builds an adjacency list from the 50 in-memory directed edges and runs Dijkstra’s algorithm to return the ordered sequence of nodes from origin to destination along with the total walking distance in meters. Node IDs used in route requests come from GET /api/nodos.
The campus graph is a static, directed chain of 51 nodes and 50 edges loaded in-memory on every request. No database reads are performed during routing, which keeps latency low but means dynamically created nodes (via
POST /api/nodos) are not reflected in route calculations until the graph is updated in source code.Get shortest path
Returns the ordered list of nodes forming the shortest path between two campus waypoints and the total distance in meters.ID of the starting node. Must exist in the static node set (
1–51).ID of the destination node. Must exist in the static node set (
1–51). Must differ from origen.Response fields
Full node object of the origin waypoint.
Full node object of the destination waypoint.
Cumulative walking distance along the computed path, in meters (rounded to 2 decimal places).
Number of edges (hops) traversed. Equal to
length(ruta) - 1.Ordered array of node objects from
origen to destino. Render these coordinates sequentially to draw the path on the map.Error responses
404 — Node not foundorigen or destino is not a valid node ID.
404 — No route available
origen is numerically greater than destino (since edges are directed forward only).
Get node type catalog
Returns all active node type definitions. Use theid values here as tipo_id when creating nodes or filtering the map by type.
activo = true.
Primary key. Use as
tipo_id in node objects.Machine-readable type name:
salon, pasillo, baño, or escaleras.Human-readable description of the node type.
Whether this type is currently in use. Inactive types are filtered out of this response.
Graph structure
The campus navigation graph used for routing has the following characteristics:| Property | Value |
|---|---|
| Nodes | 51 |
| Edges | 50 directed edges (sequential: n → n+1) |
| Edge weights | Haversine distance in meters between each pair |
| Algorithm | Dijkstra (O(V²) adjacency-list implementation) |
| Data storage | In-memory PHP array (no database I/O) |
| Notable nodes | 1 = Entrada Universidad, 17 = Punto Central, 44 = Bloque D, 49 = Cafeteria, 51 = Escalera Cafetería |
POST /api/nodos/conectar.