Skip to content

Guide · Agent skill

How to use the NetworkX Graph Analysis agent skill

Updated · written with AI from the project's own documentation and checked against our catalogue data

The NetworkX Graph Analysis skill is a set of instructions and reference files that teaches an AI agent to work with networks (graphs made of nodes and the connections between them) using the Python NetworkX library. It is written for researchers, analysts, students and developers who have relationship data and want the agent to write correct NetworkX code for it. By the end of this guide you will know what the skill does, how to install it, how to phrase requests so it triggers, and what your environment needs.

NetworkX Graph AnalysisK-Dense-AI/scientific-agent-skills · MIT

Quick start

  1. 1Download and unzip. Download the skill ZIP from this page and unzip it to produce the skill folder containing SKILL.md.
  2. 2Place the folder. Move the folder into ~/.claude/skills/ for all projects, or into a project's .claude/skills/ folder for one project only. Alternatively, upload the ZIP under Settings → Capabilities → Skills in the Claude apps.
  3. 3Prepare Python. Install Python 3.12 or newer (not 3.14.1), then install NetworkX 3.7 along with NumPy, SciPy, pandas and Matplotlib.
  4. 4Describe your network task. Ask in plain language, naming your graph type, data file and desired output, such as centrality or a plot.
  5. 5Check the weights. If your edge weights are distances, use them directly. If they are similarities, convert them to distances first, as the skill instructs.
  6. 6Review and run the script. Read the generated code, confirm file paths, then run it in your Python environment.

What is an agent skill, and what does this one do?

An agent skill is a folder containing a SKILL.md file and optional reference files. When your request matches the skill's description, the agent loads these instructions and follows them, so it works from tested patterns instead of guessing at library calls.

This skill covers graph creation, shortest paths, centrality (which nodes are most important), clustering, community detection, synthetic network generation (random, scale-free and small-world models), reading and writing graph file formats, and drawing network topologies. Common applications include social, biological, transportation and citation networks. It also points the agent to current NetworkX 3.7 functions and away from removed ones.

  • Build graphs from data with nodes and edges that carry attributes
  • Compute shortest paths, PageRank, centrality and connected components
  • Detect communities with modularity-based methods
  • Generate test networks such as Erdos-Renyi, Barabasi-Albert and Watts-Strogatz graphs
  • Read and write edge lists, GraphML, GML, JSON, CSV and adjacency matrices
  • Draw network diagrams with matplotlib

Install the skill

Download the skill ZIP from this page and unzip it. To make it available across all your projects, place the unzipped skill folder in ~/.claude/skills/. To make it available only inside one project, place it in that project's .claude/skills/ folder.

In the Claude apps you can instead upload the ZIP under Settings → Capabilities → Skills.

  • Personal (all projects): ~/.claude/skills/
  • Single project: .claude/skills/ inside the project folder
  • Claude apps: Settings → Capabilities → Skills, then upload the ZIP

Set up the Python environment it needs

The skill's examples depend on a specific environment. The skill states it requires Python 3.12 or newer, excluding 3.14.1, and NetworkX 3.7. NumPy, SciPy, pandas and Matplotlib are needed for the numerical, tabular and drawing examples. Optional integrations need their own packages.

The skill runs scripts and does not use the network during analysis, so network access is needed only for installing packages or fetching remote data. It needs no credentials.

  • Python 3.12 or newer (not 3.14.1)
  • NetworkX 3.7
  • NumPy, SciPy, pandas and Matplotlib
  • Optional integration packages only if you use them

Trigger the skill with natural requests

You do not need a special command. Describe the network task in plain language and mention graphs, networks, nodes or edges. Include the graph type if you know it, and name your input file or data source. The more specific the request, the better the agent can choose the right graph class and algorithm.

Good requests state the goal, the data and the output you want. For example, asking for the most central nodes in a citation file and a plot of the result gives the agent everything it needs.

  • Find the five most central researchers in this co-authorship edge list (collaborations.csv) using betweenness centrality.
  • Detect communities in this social network and colour each community differently in a plot.
  • Generate a 100-node scale-free network with seed 42 and save it as GraphML.
  • What is the shortest route between stations A and H in transport.edgelist, using the distance column as weight?

Example: a shortest path and centrality workflow

The skill's pattern for weighted shortest paths is to use one distance model for both the route and its length. Weights are treated as distances or costs, so larger values make a route less favourable. If your weights are similarities or interaction strengths, they must be converted to distances with a scientifically justified method before use.

Centrality and community detection use the same graph object. When you only care about the network structure, the skill sets weight to None for community detection.

import networkx as nx G = nx.Graph() G.add_weighted_edges_from([(1, 2, 1), (2, 5, 1), (1, 5, 5)], weight='distance') path = nx.shortest_path(G, source=1, target=5, weight='distance') length = nx.shortest_path_length(G, source=1, target=5, weight='distance') # path == [1, 2, 5], length == 2 degree_cent = nx.degree_centrality(G) pagerank = nx.pagerank(G)

Safety notes on scripts and data

This skill runs scripts, so read the code it generates before you run it, especially when it reads or writes files. Check that file paths point to the data you intend to use. The skill's reference files also warn that a generated model is a hypothesis about a graph, not evidence that observed data follow that model, so treat synthetic results as test material rather than findings about your real network.

Pay attention to edge weights. Using similarity values as distances gives misleading shortest paths, and the skill asks for validated, strictly positive distances when computing weighted betweenness.

  • Review generated scripts before running them on sensitive files
  • Confirm input and output paths
  • Validate weight attributes on every edge
  • Do not treat synthetic-network results as evidence about real data

Tips for better results

Give the agent a seed for random generators so results can be reproduced. Name the graph type (undirected, directed, multi-edge) because it changes which algorithms apply. If your file uses the JSON node-link format, say which version wrote it, since NetworkX 3.6 stores the edge list under the "edges" key while older files may use "links".

The skill's reference files cover graph basics, algorithms, generators, I/O and visualization. Ask for a specific one, such as the I/O guide for format questions, when your task is narrow.

  • State the graph type and whether edges are weighted
  • Provide a seed for random models
  • Name input file format and any weight column
  • Ask for the visualization reference when you need layouts or styling

What people use it for

  • Finding the most influential people in a co-authorship or collaboration network using centrality measures.
  • Detecting communities in a social network to see which groups of users are most connected to each other.
  • Computing shortest transport routes on a road or rail network where edge weights are distances.
  • Generating scale-free or small-world test networks to benchmark a graph algorithm.
  • Converting a citation or protein interaction edge list into GraphML or JSON for use in other tools.

Frequently asked questions

How do I install the NetworkX agent skill?

Download the skill ZIP from this page and unzip it into ~/.claude/skills/ for all projects, or into a project's .claude/skills/ folder for one project. In the Claude apps, you can upload the ZIP under Settings → Capabilities → Skills instead.

What do I need to run the NetworkX skill?

The skill requires Python 3.12 or newer (excluding 3.14.1) and NetworkX 3.7. NumPy, SciPy, pandas and Matplotlib support the numerical, tabular and drawing examples, and optional integrations need their own packages. It needs no credentials.

Is the NetworkX skill free?

The skill is published under the MIT licence on the source repository. NetworkX itself is a Python package you install into your own environment. This page does not state pricing for the skill beyond its listed licence.

Does the skill need internet access?

The skill runs scripts but does not use the network during analysis. Network access is only needed for installing packages or fetching remote data.

Can I use this for weighted shortest paths?

Yes, but weights are treated as distances or costs, so larger values make a route less favourable. If your weights are similarities or interaction strengths, convert them to distances with a justified method before running shortest paths or weighted betweenness.

What are the alternatives to this skill?

You can use the NetworkX library directly without the skill, writing your own scripts from the NetworkX documentation. This skill adds tested API patterns and reference guides so an agent uses current functions; if you do not use an agent, the library alone still covers these tasks.

New agent skills, repos and AI tools — every week

The best new skills and open-source projects, the fastest-growing repos, and one free prompt. Five minutes to read. Unsubscribe anytime.

Our verdict

Choose this skill if you work with network data in Python, can install Python 3.12+ and NetworkX 3.7, and want an agent to write correct NetworkX code for centrality, communities, generators, file formats and drawings. Pick something else if you cannot install Python packages, or if your work centres on other graph tools or non-Python environments.

Download the skill