본문으로 건너뛰기
Skillpedia
분석 및 스프레드시트51k · #3503

networkx

하는 일

이 도구는 사회망이나 교통망 같은 복잡한 네트워크를 만들고, 분석하고, 그립니다. 서로 다른 지점 사이의 연결을 이해하도록 돕습니다.

사용하는 경우

  • ✓사회 네트워크에서 사람들이 어떻게 연결되는지 분석할 때.
  • ✓교통 경로를 지도로 나타내고 최단 경로를 찾을 때.
  • ✓서로 다른 항목 사이 관계의 구조를 시각화할 때.

스킬 링크

https://github.com/K-Dense-AI/scientific-agent-skills/blob/main/skills/networkx/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/K-Dense-AI/scientific-agent-skills/blob/main/skills/networkx/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“친구 관계 목록으로 소셜 네트워크 그래프를 만들고, 누가 가장 많은 연결을 가졌는지 보여 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

점(노드)과 그 사이의 연결(엣지)을 설명합니다. 도구는 알고리즘을 사용해 최단 경로나 각 점의 중요도 같은 네트워크 정보를 계산합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

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.

This skill targets tested NetworkX 3.7 (Python >=3.12, excluding 3.14.1). Several pre-3.0 APIs (nx.info, nx.write_gpickle, nx.read_shp) and the 3.4-era nx.random_tree no longer exist — current replacements are used throughout this skill.

Review sources, executed examples, optional-dependency limits, and reproducibility notes are in references/review.md. Reference snippets are API patterns: supply the stated graph type and input files; they are not one sequential script.

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:

For weighted paths and betweenness, weights represent distances/costs: larger values make a route less favorable. Similarity, correlation, or interaction strength needs an explicit scientifically justified conversion before use as distance. Validate the chosen attribute on every edge and use strictly positive distances for weighted betweenness.

# Same distance model for route and length
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')
assert path == [1, 2, 5] and length == 2

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

# Specify weight=None for unweighted topology
communities = community.greedy_modularity_communities(G, weight=None)

Connectivity:

# Check connectivity
is_connected = nx.is_connected(G)

# Find connected components
components = list(nx.connected_components(G))

Reference: See references/algorithms.md for worked API patterns for common 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:


…
자주 묻는 질문

노드와 엣지란 무엇인가요?

노드는 네트워크의 개별 점(사회망에서의 사람 등)이고, 엣지는 이 점들 사이의 연결(친구 관계 등)입니다.

실제 데이터를 사용할 수 있나요?

네, 연결 목록, CSV 또는 다른 형식의 파일에서 데이터를 불러와 네트워크를 만들 수 있습니다.

도구가 네트워크를 그릴 수 있나요?

네, 네트워크의 구조를 이해하도록 그래픽 시각화를 만들 수 있습니다.

상세 정보

작성자의 원본 설명

Creates, analyzes, and visualizes complex networks and graphs in Python with NetworkX. Use when working with network/graph data structures, computing graph algorithms (shortest paths, centrality, clustering), detecting communities, generating synthetic networks (random, scale-free, small-world), reading/writing graph file formats, or drawing network topologies. Common applications include social,

repo: K-Dense-AI/scientific-agent-skills

인기도

GitHub 스타
51k
순위
#3503
라이선스
MIT
업데이트
2026. 10. 15.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬