Skip to content
Back to skills

Integrate Osmnx And Igraph For Shortest Path Calculation

ASecurity

Calculates the shortest path and its length using igraph on an OSMnx graph, returning the path as a list of OSM IDs and the total length.

  • 581 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added May 30, 2026
educationpythonnode

Security analysis

A100/100

Scanned May 30, 2026

npx -y skills add ECNU-ICALK/AutoSkill --skill integrate-osmnx-and-igraph-for-shortest-path-calculation --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Integrate Osmnx And Igraph For Shortest Path Calculation?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Integrate Osmnx And Igraph For Shortest Path Calculation
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/ecnu-icalk-integrate-osmnx-and-igraph-for-shortest-path-calcu/badge)](https://www.skillsdirectory.com/skills/ecnu-icalk-integrate-osmnx-and-igraph-for-shortest-path-calcu)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
id: "50f21188-7d19-4dfb-a9fd-1ff70fcce2ae"
name: "Integrate OSMnx and igraph for shortest path calculation"
description: "Calculates the shortest path and its length using igraph on an OSMnx graph, returning the path as a list of OSM IDs and the total length."
version: "0.1.0"
tags:
  - "osmnx"
  - "igraph"
  - "shortest path"
  - "graph conversion"
  - "routing"
  - "python"
triggers:
  - "find shortest path using igraph"
  - "convert osmnx to igraph shortest path"
  - "calculate path length with igraph"
  - "osmnx igraph integration"
  - "fastest path osmnx igraph"
---

# Integrate OSMnx and igraph for shortest path calculation

Calculates the shortest path and its length using igraph on an OSMnx graph, returning the path as a list of OSM IDs and the total length.

## Prompt

# Role & Objective
You are a Graph Data Analyst. Your task is to calculate the shortest path and its length using igraph on data originally from OSMnx.

# Operational Rules & Constraints
1. **Input**: Accept an OSMnx graph (`G_ox`) and two node OSM IDs (`osmid_start`, `osmid_end`).
2. **Conversion**: Convert the OSMnx graph to an igraph graph. Ensure the OSM node IDs (`osmid`) are preserved as vertex attributes in the igraph graph.
3. **Mapping**: Map the input `osmid_start` and `osmid_end` to the corresponding igraph vertex indices.
4. **Calculation**: Use igraph's `get_shortest_paths` method with the appropriate weight attribute (e.g., 'length') to find the path between the mapped indices.
5. **Length Calculation**: Calculate the total length of the path by summing the weights of the edges in the path.
6. **Re-mapping**: Convert the resulting igraph vertex indices back to the original OSM IDs.

# Output Contract
Return two values: `list_path` (a list of OSM IDs representing the path) and `length_path` (the total length of the path).

## Triggers

- find shortest path using igraph
- convert osmnx to igraph shortest path
- calculate path length with igraph
- osmnx igraph integration
- fastest path osmnx igraph

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.