graph-algorithms

A collection of patterns for solving problems involving connected items and relationships, such as roads between cities or dependencies between tasks. It covers breadth-first search, depth-first search, shortest paths, ordering, and grouping.

In plain words
What is it for?
Use it for graphs, trees, routes, dependency ordering, connectivity checks, minimum connection costs, and two-group coloring problems.
Why use it?
It helps you choose an algorithm based on the kind of relationship, path, or connection the problem describes.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/sequenzia/agent-alchemy/graph-algorithms
Any agent
npx skills add sequenzia/agent-alchemy --skill graph-algorithms
Clone the repo
git clone --depth 1 https://github.com/sequenzia/agent-alchemy

Made for: Claude Code, Codex.

Per session 74 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 4,545 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00074 $0.04545
Opus 5 $0.00037 $0.02273
Sonnet 5 $0.00015 $0.00909
Haiku 4.5 $0.00007 $0.00455

Measured 3d ago against content hash c895f4a1a784, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

graph-algorithms scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

claude/cs-tools/skills/graph-algorithms/SKILL.md · 479 lines

How it starts

The opening of the file, as written. The whole thing — 479 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Graph Algorithm Patterns

Graph problems appear frequently in competitive programming and technical interviews. The key challenge is recognizing which technique fits the problem structure. This reference covers eight core patterns with recognition heuristics, templates, and pitfall guides.


Pattern Recognition Table

Trigger Signals Technique Typical Complexity
Shortest path, unweighted, fewest steps BFS O(V + E)
Explore all paths, connected components, backtracking DFS O(V + E)
Shortest path, weighted (non-negative) Dijkstra O((V + E) log V)
Dependencies, ordering, DAG Topological Sort O(V + E)
Dynamic connectivity, "are X and Y connected?" Union-Find (DSU) O(alpha(N)) per op
Minimum cost to connect all nodes MST (Kruskal/Prim) O(E log E)
Weighted shortest path with negative edges Bellman-Ford O(V * E)
Two groups, coloring, odd cycle Bipartite Check O(V + E)

Constraint-to-Technique Mapping

Use V (vertices) and E (edges) bounds to narrow viable algorithms:

Constraint Range Viable Techniques Notes
V <= 20 Bitmask DP, brute-force BFS/DFS Exponential OK
V <= 1,000, E <= 10,000 All techniques, Floyd-Warshall for APSP O(V^3) still feasible
V <= 100,000, E <= 200,000 BFS, DFS, Dijkstra, Topo Sort, DSU, MST Standard competitive range
V <= 1,000,000 BFS, DFS, DSU, Kahn's Avoid O(V log V) heaps if possible
Negative weights present Bellman-Ford, SPFA Dijkstra invalid
Dense graph (E ~ V^2) Prim (adj matrix), Floyd-Warshall Adjacency list Dijkstra still works
Edges arrive online Union-Find Incremental connectivity

Individual Patterns

BFS (Breadth-First Search)

Recognition Signals

  • "Shortest path" or "minimum steps" in an unweighted graph or grid
  • "Level-order traversal" or "distance from source"
  • Multiple starting points (multi-source BFS)
  • "Nearest" something in a grid

Core Idea

Read the full file on GitHub · 479 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 479 lines · 74 tokens per session scan A c895f4a1a784

Subscribe to this mod's changes

graph-algorithms is a skill published in the GitHub repository sequenzia/agent-alchemy (43 stars, last pushed 3mo ago), licensed MIT. It adds 74 tokens to every session and 4,545 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

qc-helper

Answer any question about Qwen Code usage, features, configuration, and troubleshooting by referencing the official user documentation. Also helps users view or modify their settings.json. Invoke with /qc-helper followed by a question, e.g. /qc-helper how do I configure MCP servers? or /qc-helper change approval mode…

QwenLM/qwen-code · 71 tokens

agent-newbie-guide

Skill "agent-newbie-guide" from hashgraph-online/awesome-codex-plugins, covering codex 新手引导, 🚫 新手术语过滤(绝对禁止), 统一行为规范(内嵌), 📍 阶段位置 and 启动自检.

hashgraph-online/awesome-codex-plugins · 87 tokens

agent-learning-coach

中文学习教练技能。用于学习编程、英语、设计、产品、AI、数学或任何技能时,先诊断水平,再用讲解、练习、反馈、复习的循环推进。触发语包括"进入学习模式""我想学""带我练""帮我制定学习计划""像教练一样教我"。.

hashgraph-online/awesome-codex-plugins · 81 tokens

memstack-development-mentor

Use when the user says 'teach me', 'explain as you go', 'mentor mode', 'walk me through', 'help me learn', 'explain why', 'learning mode', or wants real-time plain language narration of decisions and tradeoffs while building. Do NOT use for code review or debugging.

cwinvestments/memstack · 69 tokens

map-understand

Interactive deep-understanding and quiz mode for MAP sessions. Use when the user wants to understand code, a diff, workflow result, debugging cause, or architecture and be checked with restatements or quizzes.

azalio/map-framework · 45 tokens

self-assessment

Interactive skill assessment with personalized learning path generation.

FlorianBruniaux/claude-code-ultimate-guide · 12 tokens