networkx

networkx is a skill for Claude Code, Codex from SenolIsci/mykg. It costs 163 tokens per session (6,243 once invoked), scanned A, original, MIT.

A Python guide for creating, studying, and displaying networks and graphs with NetworkX. In this context, a graph is a set of connected items, such as people, web pages, routes, or software dependencies.

In plain words
What is it for?
Use it to build graphs, find shortest paths, measure centrality, detect communities, convert graphs to tables or matrices, and visualize network relationships.
Why use it?
It helps choose the right graph structure and apply standard methods without having to design those operations from scratch.

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/senolisci/mykg/networkx
Any agent
npx skills add SenolIsci/mykg --skill networkx
Clone the repo
git clone --depth 1 https://github.com/SenolIsci/mykg

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for networkx

README.md
[![agentmods](https://agentmods.dev/badge/skills/senolisci/mykg/networkx.svg)](https://agentmods.dev/skills/senolisci/mykg/networkx)
Your own site
<a href="https://agentmods.dev/skills/senolisci/mykg/networkx"><img src="https://agentmods.dev/badge/skills/senolisci/mykg/networkx.svg" alt="Measured on agentmods" height="20"></a>
Per session 163 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 6,243 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.00163 $0.06243
Opus 5 $0.00081 $0.03121
Sonnet 5 $0.00033 $0.01249
Haiku 4.5 $0.00016 $0.00624

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

Security

Grade A, and why

networkx 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 5d 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/skills/networkx/SKILL.md · 777 lines

How it starts

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

NetworkX Skill — Create and Manipulate Networks

NetworkX (v3.6+) is the standard Python library for graph analysis. This skill covers everything from basic graph creation to advanced algorithms. When in doubt, prefer simple explicit code over clever one-liners — graphs are complex enough on their own.

References:

  • algorithms.md — Algorithm reference by category (centrality, community, flow, etc.)
  • io.md — File I/O and format conversion reference

1. Choosing a Graph Class

Pick the right class first — it cannot easily be changed after construction.

import networkx as nx

G  = nx.Graph()          # undirected, no parallel edges
DG = nx.DiGraph()        # directed, no parallel edges
MG = nx.MultiGraph()     # undirected + parallel edges allowed
MD = nx.MultiDiGraph()   # directed + parallel edges allowed
Need Class
Social networks, protein interactions Graph
Web graphs, citation networks, DAGs DiGraph
Transport networks (multiple routes) MultiGraph
Dependency graphs with typed edges MultiDiGraph

Convert between types:

DG = G.to_directed()    # Graph → DiGraph (each edge becomes two arcs)
G2 = DG.to_undirected() # DiGraph → Graph

2. Building Graphs

Add Nodes

Any hashable Python object is a valid node: int, str, tuple, frozenset.

G.add_node(1)
G.add_node("Alice", age=30, role="engineer")   # node with attributes
G.add_nodes_from([2, 3, 4])
G.add_nodes_from([
    ("Bob",   {"age": 25, "role": "designer"}),
    ("Carol", {"age": 35, "role": "manager"}),
])

Add Edges

G.add_edge(1, 2)
G.add_edge("Alice", "Bob", weight=0.9, relation="colleague")
G.add_edges_from([(1, 2), (2, 3), (3, 4)])
G.add_edges_from([
    (1, 2, {"weight": 1.5}),
    (2, 3, {"weight": 0.8}),
])
G.add_weighted_edges_from([(1, 2, 1.5), (2, 3, 0.8)])  # shorthand

For MultiGraph, add_edge returns the edge key (int):

k = MG.add_edge(1, 2, weight=0.5)   # k=0
k = MG.add_edge(1, 2, weight=0.75)  # k=1 (parallel edge)

Read the full file on GitHub · 777 lines

Files

What ships with it

2 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 5d ago First seen · 777 lines · 163 tokens per session scan A 3c814bfcde44

Subscribe to this mod's changes

networkx is a skill published in the GitHub repository SenolIsci/mykg (69 stars, last pushed 3d ago), licensed MIT. It adds 163 tokens to every session and 6,243 once invoked, about $0.0008 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

ontology-build-team

Turn research outputs into a domain ontology draft using layered modeling, SKOS-first conceptualization, selective OWL formalization, and explicit modeling decisions tied back to evidence.

Mokee04/ontology_research · 37 tokens

ontology-shacl-validator

Validate ontology outputs through SHACL-oriented checks, structural issue reporting, and release-readiness notes tied to competency questions, evidence quality, and unresolved modeling risks.

Mokee04/ontology_research · 36 tokens

ontology-technical-plan-writer

Draft or refine a technical planning document template for an ontology project. Use when the user wants a technical proposal, planning brief, or reusable template that connects scope, competency questions, standards reuse, modeling approach, validation, governance, and execution phases without drifting into a…

Mokee04/ontology_research · 63 tokens

ontology-validation-team

Validate a domain ontology draft using competency-question checks, SHACL-oriented structural validation, review gates, and release-readiness criteria before the ontology is treated as stable.

Mokee04/ontology_research · 36 tokens

ontology-domain-intake

Clarify the target domain for ontology work by defining scope, users, constraints, out-of-scope areas, and approval points before modeling starts.

Mokee04/ontology_research · 34 tokens

ontology-evidence-curator

Curate ontology-ready evidence from collected sources by capturing concept definitions, relation clues, constraints, reuse notes, data collection feasibility, and source-grounded synthesis in the exe folder.

Mokee04/ontology_research · 41 tokens