networkx

Create, analyze, and visualize complex networks and graphs in Python with NetworkX.

1|Updated Aug 24, 2026
One-click install
npx skills add https://github.com/CliffVale/opencode-free-setup --skill networkx-cliffvale
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: networkx
Source: https://github.com/CliffVale/opencode-free-setup/tree/main/skills/networkx
Command: npx skills add https://github.com/CliffVale/opencode-free-setup --skill networkx-cliffvale

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires networkx, matplotlib, pandas, numpy, scipy, and includes references (resource) components.

What problem does it solve? Working with network and graph data in Python requires knowing dozens of algorithms, file formats, and visualization options. This Skill provides structured guidance for building graphs, running analyses like centrality and community detection, and producing clear network visualizations without memorizing the NetworkX API. ## Core Features & Use Cases - Graph Creation & Manipulation: Build directed, undirected, and multi-edge graphs from edge lists, DataFrames, NumPy arrays, or files like GraphML and GML. - Graph Algorithms: Compute shortest paths, centrality measures, PageRank, clustering coefficients, community detection, maximum flow, and minimum spanning trees. - Synthetic Network Generation: Generate random, scale-free, small-world, lattice, and social network models for testing and simulation. - Visualization: Draw networks with matplotlib layouts, customize node and edge appearance, and export publication-quality figures or interactive Plotly/PyVis visualizations. - Use Case: Given a CSV of protein interactions, load it into a graph, detect communities with greedy modularity, compute betweenness centrality to find key proteins, and export a colored network figure. ## Quick Start Use the networkx skill to load my edges.csv file, compute PageRank for every node, and draw the network with node sizes scaled by centrality.

Frequently Asked Questions about networkx

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I find the shortest path between two nodes in NetworkX?▼

Use nx.shortest_path(G, source, target) to get the path and nx.shortest_path_length for its length. For weighted graphs, pass weight='weight' to use Dijkstra's algorithm with edge weights.

How do I detect communities in a network with Python?▼

Import the community module from networkx.algorithms and call community.greedy_modularity_communities(G) for modularity-based detection. Label propagation and Girvan-Newman methods are also available for different network structures.

What graph file formats does NetworkX support?▼

NetworkX reads and writes edge lists, adjacency lists, GraphML, GML, GEXF, Pajek, and JSON node-link formats. It also converts to and from pandas DataFrames, NumPy arrays, and SciPy sparse matrices.

Does NetworkX work with large graphs efficiently?▼

NetworkX loads graphs fully into memory, so very large networks can be slow. Use approximate algorithms with the k parameter, sparse matrix representations, or accelerated backends like nx-cugraph and nx-parallel via the backend keyword.

Why did nx.random_tree stop working in my code?▼

nx.random_tree was removed in NetworkX 3.4. Use nx.random_labeled_tree(n, seed=42) for a uniform labeled tree or nx.random_unlabeled_tree for sampling over isomorphism classes instead.