Working with network and graph data requires understanding graph algorithms, visualization techniques, and data formats. This skill provides comprehensive guidance on using NetworkX for creating, analyzing, and visualizing complex networks in Python.
下载技能 ZIP
在 Claude 中上传
前往 设置 → 功能 → 技能 → 上传技能
开启并开始使用
测试它
正在使用“networkx”。 Create a graph with 5 nodes connected in a cycle and compute the shortest path from node 1 to node 5
预期结果:
Path found: [1, 2, 3, 4, 5] with length 4
正在使用“networkx”。 Find the node with highest betweenness centrality in a social network
预期结果:
User 'alice' has the highest betweenness centrality (0.45), indicating significant influence in connecting different groups
正在使用“networkx”。 Generate a scale-free network with 100 nodes
预期结果:
Generated Barabasi-Albert graph with 100 nodes and 297 edges using preferential attachment
安全审计
安全All static findings are false positives. The skill is a documentation/reference guide for NetworkX (Python graph library). Static scanner flagged markdown code formatting backticks as 'shell execution' and documentation about file I/O operations as 'filesystem access'. No malicious code, credential access, or command injection exists. The skill provides safe Python graph processing guidance.
风险因素
质量评分
你能构建什么
Analyze social network relationships
Build and analyze social network graphs to identify influential users, detect communities, and find connection patterns.
Model biological networks
Create protein interaction networks, gene regulatory networks, or neural connectivity maps for biological research.
Optimize infrastructure routes
Find shortest paths, design efficient transportation networks, and analyze connectivity in infrastructure systems.
试试这些提示
How do I create a basic graph using NetworkX and add nodes and edges with attributes?
Find the shortest path between two nodes in my graph and calculate the total distance considering edge weights.
Compute centrality measures (betweenness, degree, PageRank) to identify the most influential nodes in my network.
Detect communities in my graph using modularity-based methods and visualize the results with different colors for each community.
最佳实践
- Set random seeds (seed=42) when generating random graphs or layouts for reproducibility
- Use appropriate graph types (Graph, DiGraph, MultiGraph) based on whether edges are directed and if multiple edges exist
- Choose efficient file formats like GraphML for preserving attributes or pickle for large Python objects
避免
- Avoid using floating-point numbers as node identifiers due to precision comparison issues
- Do not attempt to draw very large graphs (>1000 nodes) without filtering or clustering first
- Avoid modifying a graph while iterating over its nodes or edges without creating a copy first