elementary-graph-algorithms

A guide to standard graph algorithms, where graphs represent items connected by relationships.

In plain words
What is it for?
It helps solve reachability and path problems, organize dependency graphs, find connected regions, detect bridges and articulation points, and construct Euler tours.
Why use it?
It explains how to choose graph representations and search methods while preserving the conditions needed for correct results and running-time estimates.

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/arcadi4/nerdy/elementary-graph-algorithms
Any agent
npx skills add Arcadi4/nerdy --skill elementary-graph-algorithms
Clone the repo
git clone --depth 1 https://github.com/Arcadi4/nerdy

Made for: Claude Code, Codex.

Per session 61 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,814 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.00061 $0.03814
Opus 5 $0.00030 $0.01907
Sonnet 5 $0.00012 $0.00763
Haiku 4.5 $0.00006 $0.00381

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

Security

Grade A, and why

elementary-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 2d 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.

clrs/elementary-graph-algorithms/SKILL.md · 348 lines

How it starts

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

Elementary Graph Algorithms

Overview

Graph-search answers must bind the representation contract to the invariant being used. Breadth-first search is a layer and shortest-unweighted-path argument; depth-first search is an interval, ancestor, and finish-time argument; topological sorting and strongly connected components are finish-time applications, not just traversal recipes.

Shared CLRS Conventions

  • Follow the parent clrs skill for mathematical formatting: every expression, bound, inequality, or recurrence goes in a display LaTeX block, never in prose, tables, headings, or inline code spans.
  • Use CLRS graph notation and theorem numbers when they clarify the proof.
  • State whether the graph is directed or undirected before classifying edges or claiming reachability.
  • State the representation before giving a running time.
  • Treat adjacency-list order as an input-order detail: it can change discovery order and predecessor trees, but not breadth-first distances.

When to Use

Use this skill for:

  • Choosing adjacency lists, adjacency matrices, or augmented adjacency structures.
  • Breadth-first search for unweighted single-source shortest paths, layers, reachability, and breadth-first trees.
  • Depth-first search for timestamp intervals, ancestor reasoning, edge classification, cycle detection, articulation points, bridges, and biconnected components.
  • Topological sorting of directed acyclic graphs.
  • Strongly connected components using the two-pass transpose algorithm.
  • Euler-tour existence in directed graphs and reachability questions that reduce to component condensation.

Do not use it as the main skill for weighted shortest paths, minimum spanning trees, maximum flow, matching, or dynamic graph maintenance unless the immediate task is the representation or the initial traversal invariant.

Quick Reference

Problem shape Use Required precondition Main proof hook
Sparse graph traversal Adjacency lists Neighbor iteration dominates Scan each list once
Dense edge-existence queries Adjacency matrix Vertices have stable indices Constant edge lookup, quadratic storage
Unweighted shortest paths from one source Breadth-first search Unit edge cost or edge count metric Layer monotonicity
Ancestors, descendants, and cycle witnesses Depth-first search Fixed vertex and adjacency iteration order for exact forest Parenthesis and white-path theorems
Linear order of prerequisites Topological sort Directed acyclic graph Decreasing finish times
Mutual reachability classes Strongly connected components Directed graph Component finish-time ordering on the transpose
Undirected cut vertices and bridges Depth-first low values Connected component considered with tree and back edges Subtree escape to a proper ancestor

Read the full file on GitHub · 348 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. 2d ago First seen · 348 lines · 61 tokens per session scan A b7a2104cb08f

Subscribe to this mod's changes

elementary-graph-algorithms is a skill published in the GitHub repository Arcadi4/nerdy (7 stars, last pushed 4mo ago), licensed MIT. It adds 61 tokens to every session and 3,814 once invoked, about $0.0003 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-31.

Related

Other skills, from other repositories

coding

编写并运行 Python 代码,验证脚本逻辑和输出。.

bojieli/ai-agent-book · 18 tokens

thermite

Thermite, the generic ISA-portable Rust SIMD library, and its thermite- companions (special, dual/autodiff, compensated/double-double, sort, sdf, geometry, ffi). Load when writing/reviewing/debugging code using thermite/thermite- crates - GenericVector/NumericVector/FloatVector bounds, the policy math library, masks…

raygon-renderer/thermite · 195 tokens

java-algorithm-patterns

5 algorithm patterns with full Java implementations for common coding problems.

bobmatnyc/claude-mpm-agents · 18 tokens

python-algorithm-cookbook

4 algorithm patterns with full Python implementations for common coding problems.

bobmatnyc/claude-mpm-agents · 19 tokens

wxjava-module-selector

根据微信公众号、小程序、微信支付、企业微信、开放平台、视频号或微信小店、腾讯企点和微信智能对话等业务场景,为用户选择合适的 WxJava Maven 模块、BOM 和示例入口。适用于用户询问“该用哪个模块”、依赖坐标、产品边界或单/多账号 Starter 选择时。.

binarywang/WxJava · 86 tokens

cpp-pro

Writes, optimizes, and debugs C++ applications using modern C++20/23 features, template metaprogramming, and high-performance systems techniques. Use when building or refactoring C++ code requiring concepts, ranges, coroutines, SIMD optimization, or careful memory management — or when addressing performance…

Jeffallan/claude-skills · 79 tokens