/networkx
Comprehensive toolkit for creating, analyzing, and visualizing complex networks and graphs in Python. Use when working with network/graph data structures, analyzing relationships between entities, computing graph algorithms (shortest paths, centrality, clustering), detecting
$ npx -y skills add foryourhealth111-pixel/Vibe-Skills --skill networkx --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
- Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
- You can call itInvoke it directly when you want it.
- Slash command
/networkx
Context preview
The summary Claude sees to decide when to auto-load this skill.
Comprehensive toolkit for creating, analyzing, and visualizing complex networks and graphs in Python. Use when working with network/graph data structures, analyzing relationships between entities, computing graph algorithms (shortest paths, centrality, clustering), detecting
SKILL.md
networkx.SKILL.mdname: networkx
description: Comprehensive toolkit for creating, analyzing, and visualizing complex networks and graphs in Python. Use when working with network/graph data structures, analyzing relationships between entities, computing graph algorithms (shortest paths, centrality, clustering), detecting communities, generating synthetic networks, or visualizing network topologies. Applicable to social networks, biological networks, transportation systems, citation networks, and any domain involving pairwise relationships.
NetworkX
Overview
NetworkX is a Python package for creating, manipulating, and analyzing complex networks and graphs. Use this skill when working with network or graph data structures, including social networks, biological networks, transportation systems, citation networks, knowledge graphs, or any system involving relationships between entities.
When to Use This Skill
Invoke this skill when tasks involve:
- **Creating graphs**: Building network structures from data, adding nodes and edges with attributes
- **Graph analysis**: Computing centrality measures, finding shortest paths, detecting communities, measuring clustering
- **Graph algorithms**: Running standard algorithms like Dijkstra's, PageRank, minimum spanning trees, maximum flow
- **Network generation**: Creating synthetic networks (random, scale-free, small-world models) for testing or simulation
- **Graph I/O**: Reading from or writing to various formats (edge lists, GraphML, JSON, CSV, adjacency matrices)
- **Visualization**: Drawing and customizing network visualizations with matplotlib or interactive libraries
- **Network comparison**: Checking isomorphism, computing graph metrics, analyzing structural properties
Core Capabilities
1. Graph Creation and Manipulation
NetworkX supports four main graph types:
- **Graph**: Undirected graphs with single edges
- **DiGraph**: Directed graphs with one-way connections
- **MultiGraph**: Undirected graphs allowing multiple edges between nodes
- **MultiDiGraph**: Directed graphs with multiple edges
Create graphs by:
import networkx as nx
# Create empty graph
G = nx.Graph()
# Add nodes (can be any hashable type)
G.add_node(1)
G.add_nodes_from([2, 3, 4])
G.add_node("protein_A", type='enzyme', weight=1.5)
# Add edges
G.add_edge(1, 2)
G.add_edges_from([(1, 3), (2, 4)])
G.add_edge(1, 4, weight=0.8, relation='interacts')**Reference**: See `references/graph-basics.md` for comprehensive guidance on creating, modifying, examining, and managing graph structures, including working with attributes and subgraphs.
2. Graph Algorithms
NetworkX provides extensive algorithms for network analysis:
**Shortest Paths**:
# Find shortest path
path = nx.shortest_path(G, source=1, target=5)
length = nx.shortest_path_length(G, source=1, target=5, weight='weight')
**Centrality Measures**:
# Degree centrality
degree_cent = nx.degree_centrality(G)
# Betweenness centrality
betweenness = nx.betweenness_centrality(G)
# PageRank
pagerank = nx.pagerank(G)
**Community Detection**:
from networkx.algorithms import community
# Detect communities
communities = community.greedy_modularity_communities(G)
**Connectivity**:
# Check connectivity
is_connected = nx.is_connected(G)
# Find connected components
components = list(nx.connected_components(G))
**Reference**: See `references/algorithms.md` for detailed documentation on all available algorithms including shortest paths, centrality measures, clustering, community detection, flows, matching, tree algorithms, and graph traversal.
3. Graph Generators
Create synthetic networks for testing, simulation, or modeling:
**Classic Graphs**:
# Complete graph
G = nx.complete_graph(n=10)
# Cycle graph
G = nx.cycle_graph(n=20)
# Known graphs
G = nx.karate_club_graph()
G = nx.petersen_graph()
**Random Networks**:
# Erdős-Rényi random graph
G = nx.erdos_renyi_graph(n=100, p=0.1, seed=42)
# Barabási-Albert scale-free network
G = nx.barabasi_albert_graph(n=100, m=3, seed=42)
# Watts-Strogatz small-world network
G = nx.watts_strogatz_graph(n=100, k=6, p=0.1, seed=42)
**Structured Networks**:
# Grid graph
G = nx.grid_2d_graph(m=5, n=7)
# Random tree
G = nx.random_tree(n=100, seed=42)
**Reference**: See `references/generators.md` for comprehensive coverage of all graph generators including classic, random, lattice, bipartite, and specialized network models with detailed parameters and use cases.
4. Reading and Writing Graphs
NetworkX supports numerous file formats and data sources:
**File Formats**:
# Edge list
G = nx.read_edgelist('graph.edgelist')
nx.write_edgelist(G, 'graph.edgelist')
# GraphML (preserves attributes)
G = nx.read_graphml('graph.graphml')
nx.write_graphml(G, 'graph.graphml')
# GML
G = nx.read_gml('graph.gml')
nx.write_gml(G, 'graph.gml')
# JSON
data = nx.node_link_data(G)
G = nx.node_link_graph(data)**Pandas Integration**:
import pandas as pd
# From DataFrame
df = pd.DataFrame({'source': [1, 2, 3], 'target': [2, 3, 4], 'weight': [0.5, 1.0, 0.75]})
G = nx.from_pandas_edgelist(df, 'source', 'target', edge_attr='weight')
# To DataFrame
df = nx.to_pandas_edgelist(G)**Matrix Formats**:
import numpy as np
# Adjacency matrix
A = nx.to_numpy_array(G)
G = nx.from_numpy_array(A)
# Sparse matrix
A = nx.to_scipy_sparse_array(G)
G = nx.from_scipy_sparse_array(A)
**Reference**: See `references/io.md` for complete documentation on all I/O formats including CSV, SQL databases, Cytoscape, DOT, and guidance on format selection for different use cases.
5. Visualization
Create clear and informative network visualizations:
**Basic Visualization**:
import matplotlib.pyplot as plt
# Simple draw
nx.draw(G, with_labels=True)
plt.show()
# With layout
pos = nx.spring_layout(G, seed=42)
nx.draw(G, pos=pos, with_labels=True, node_colo
Read more
name: networkx description: Comprehensive toolkit for creating, analyzing, and visualizing complex networks and graphs in Python. Use when working with network/graph data structures, analyzing relationships between entities, computing graph algorithms (shortest paths, centrality, clustering), detecting communities, generating synthetic networks, or visualizing network topologies. Applicable to social networks, biological networks, transportation systems, citation networks, and any domain involving pairwise relationships.
NetworkX
Overview
NetworkX is a Python package for creating, manipulating, and analyzing complex networks and graphs. Use this skill when working with network or graph data structures, including social networks, biological networks, transportation systems, citation networks, knowledge graphs, or any system involving relationships between entities.
When to Use This Skill
Invoke this skill when tasks involve:
- **Creating graphs**: Building network structures from data, adding nodes and edges with attributes
- **Graph analysis**: Computing centrality measures, finding shortest paths, detecting communities, measuring clustering
- **Graph algorithms**: Running standard algorithms like Dijkstra's, PageRank, minimum spanning trees, maximum flow
- **Network generation**: Creating synthetic networks (random, scale-free, small-world models) for testing or simulation
- **Graph I/O**: Reading from or writing to various formats (edge lists, GraphML, JSON, CSV, adjacency matrices)
- **Visualization**: Drawing and customizing network visualizations with matplotlib or interactive libraries
- **Network comparison**: Checking isomorphism, computing graph metrics, analyzing structural properties
Core Capabilities
1. Graph Creation and Manipulation
NetworkX supports four main graph types:
- **Graph**: Undirected graphs with single edges
- **DiGraph**: Directed graphs with one-way connections
- **MultiGraph**: Undirected graphs allowing multiple edges between nodes
- **MultiDiGraph**: Directed graphs with multiple edges
Create graphs by:
import networkx as nx
# Create empty graph
G = nx.Graph()
# Add nodes (can be any hashable type)
G.add_node(1)
G.add_nodes_from([2, 3, 4])
G.add_node("protein_A", type='enzyme', weight=1.5)
# Add edges
G.add_edge(1, 2)
G.add_edges_from([(1, 3), (2, 4)])
G.add_edge(1, 4, weight=0.8, relation='interacts')**Reference**: See `references/graph-basics.md` for comprehensive guidance on creating, modifying, examining, and managing graph structures, including working with attributes and subgraphs.
2. Graph Algorithms
NetworkX provides extensive algorithms for network analysis:
**Shortest Paths**:
# Find shortest path path = nx.shortest_path(G, source=1, target=5) length = nx.shortest_path_length(G, source=1, target=5, weight='weight')
**Centrality Measures**:
# Degree centrality degree_cent = nx.degree_centrality(G) # Betweenness centrality betweenness = nx.betweenness_centrality(G) # PageRank pagerank = nx.pagerank(G)
**Community Detection**:
from networkx.algorithms import community # Detect communities communities = community.greedy_modularity_communities(G)
**Connectivity**:
# Check connectivity is_connected = nx.is_connected(G) # Find connected components components = list(nx.connected_components(G))
**Reference**: See `references/algorithms.md` for detailed documentation on all available algorithms including shortest paths, centrality measures, clustering, community detection, flows, matching, tree algorithms, and graph traversal.
3. Graph Generators
Create synthetic networks for testing, simulation, or modeling:
**Classic Graphs**:
# Complete graph G = nx.complete_graph(n=10) # Cycle graph G = nx.cycle_graph(n=20) # Known graphs G = nx.karate_club_graph() G = nx.petersen_graph()
**Random Networks**:
# Erdős-Rényi random graph G = nx.erdos_renyi_graph(n=100, p=0.1, seed=42) # Barabási-Albert scale-free network G = nx.barabasi_albert_graph(n=100, m=3, seed=42) # Watts-Strogatz small-world network G = nx.watts_strogatz_graph(n=100, k=6, p=0.1, seed=42)
**Structured Networks**:
# Grid graph G = nx.grid_2d_graph(m=5, n=7) # Random tree G = nx.random_tree(n=100, seed=42)
**Reference**: See `references/generators.md` for comprehensive coverage of all graph generators including classic, random, lattice, bipartite, and specialized network models with detailed parameters and use cases.
4. Reading and Writing Graphs
NetworkX supports numerous file formats and data sources:
**File Formats**:
# Edge list
G = nx.read_edgelist('graph.edgelist')
nx.write_edgelist(G, 'graph.edgelist')
# GraphML (preserves attributes)
G = nx.read_graphml('graph.graphml')
nx.write_graphml(G, 'graph.graphml')
# GML
G = nx.read_gml('graph.gml')
nx.write_gml(G, 'graph.gml')
# JSON
data = nx.node_link_data(G)
G = nx.node_link_graph(data)**Pandas Integration**:
import pandas as pd
# From DataFrame
df = pd.DataFrame({'source': [1, 2, 3], 'target': [2, 3, 4], 'weight': [0.5, 1.0, 0.75]})
G = nx.from_pandas_edgelist(df, 'source', 'target', edge_attr='weight')
# To DataFrame
df = nx.to_pandas_edgelist(G)**Matrix Formats**:
import numpy as np # Adjacency matrix A = nx.to_numpy_array(G) G = nx.from_numpy_array(A) # Sparse matrix A = nx.to_scipy_sparse_array(G) G = nx.from_scipy_sparse_array(A)
**Reference**: See `references/io.md` for complete documentation on all I/O formats including CSV, SQL databases, Cytoscape, DOT, and guidance on format selection for different use cases.
5. Visualization
Create clear and informative network visualizations:
**Basic Visualization**:
import matplotlib.pyplot as plt # Simple draw nx.draw(G, with_labels=True) plt.show() # With layout pos = nx.spring_layout(G, seed=42) nx.draw(G, pos=pos, with_labels=True, node_colo
VibeSkills is a general-purpose Skill that automatically routes local Skills and intelligently orchestrates harness workflows.
Repo: foryourhealth111-pixel/Vibe-Skills
Other skills on vibe-skills.
- /LQF_Machine_Learning_Expert_Guide
LQF Machine Learning Expert Guide - Routed skill for ML/Statistical Modeling with Critical Discussion Mode. Triggers on: machine learning, modeling, prediction, training, classification, regression, clustering, deep learning, neural network, model evaluation, feature
Open skill - /adaptyv
Cloud laboratory platform for automated protein testing and validation. Use when designing proteins and needing experimental validation including binding assays, expression testing, thermostability measurements, enzyme activity assays, or protein sequence optimization. Also use
Open skill - /aeon
This skill should be used for time series machine learning tasks including classification, regression, clustering, forecasting, anomaly detection, segmentation, and similarity search. Use when working with temporal data, sequential patterns, or time-indexed observations
Open skill - /algorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code, generative art, algorithmic art, flow fields, or particle systems. Create original algorithmic art rather than copying existing
Open skill - /alpha-vantage
Access real-time and historical stock market data, forex rates, cryptocurrency prices, commodities, economic indicators, and 50+ technical indicators via the Alpha Vantage API. Use when fetching stock prices (OHLCV), company fundamentals (income statement, balance sheet, cash
Open skill - /architecture-patterns
Implement proven backend architecture patterns including Clean Architecture, Hexagonal Architecture, and Domain-Driven Design. Use when architecting complex backend systems or refactoring existing applications for better maintainability.
Open skill
