Visualize Graph
by wfukatsu
GraphDB可視化エージェント - RyuGraphデータベースの内容をMermaid/DOT/HTML形式で可視化。/visualize-graph [出力パス] で呼び出し。
Skill Details
Repository Files
1 file in this skill directory
name: visualize-graph description: GraphDB可視化エージェント - RyuGraphデータベースの内容をMermaid/DOT/HTML形式で可視化。/visualize-graph [出力パス] で呼び出し。 user_invocable: true
GraphDB Visualizer Agent
RyuGraphデータベースの内容を可視化し、Mermaid図やインタラクティブHTMLとして出力するエージェントです。
目的
このエージェントは以下の機能を提供します:
- Mermaid図生成 - ノードとリレーションをMermaid形式で可視化
- DOT形式出力 - Graphviz用のDOT形式で出力
- インタラクティブHTML - D3.jsを使ったインタラクティブグラフ
- フィルタリング - 特定のドメインやノードタイプでフィルタ
前提条件
- Python 3.9+
- ryugraph パッケージ
- pandas パッケージ
- (オプション)graphvizパッケージ(DOT → PNG変換用)
- (オプション)mermaid-cli(Mermaid → PNG変換用)
実行プロンプト
あなたはGraphDBを可視化する専門家エージェントです。以下の手順で可視化を実行してください。
Step 1: 環境確認
# データベースの存在確認
ls -la knowledge.ryugraph
# ryugraph がインストールされているか確認
source .venv/bin/activate && python -c "import ryugraph; print('OK')"
Step 2: 可視化スクリプトの実行
可視化スクリプトを実行してグラフを生成します:
source .venv/bin/activate && python scripts/visualize_graph.py \
--db-path ./knowledge.ryugraph \
--output-dir ./reports/graph/visualizations \
--format all
Step 3: 出力形式
Mermaid形式 (graph.mmd)
graph LR
subgraph "Identity Domain"
User[User]
UserService[UserService]
end
subgraph "Audit Domain"
AuditSet[AuditSet]
AuditSetService[AuditSetService]
end
User -->|BELONGS_TO| Identity
AuditSet -->|BELONGS_TO| Audit
AuditSetService -->|REFERENCES| AuditSet
DOT形式 (graph.dot)
digraph G {
rankdir=LR;
node [shape=box];
subgraph cluster_identity {
label="Identity Domain";
User;
UserService;
}
User -> Identity [label="BELONGS_TO"];
}
インタラクティブHTML (graph.html)
D3.jsを使用したフォースレイアウトグラフ。ノードのドラッグ、ズーム、検索機能を提供。
Step 4: フィルタリングオプション
特定のデータのみを可視化:
# ドメインでフィルタ
python scripts/visualize_graph.py --domain Audit
# ノードタイプでフィルタ
python scripts/visualize_graph.py --node-type Entity
# リレーションタイプでフィルタ
python scripts/visualize_graph.py --rel-type BELONGS_TO
# 深さ制限
python scripts/visualize_graph.py --max-depth 2
Step 5: 画像変換(オプション)
# Mermaid → PNG/SVG
mmdc -i graph.mmd -o graph.png
mmdc -i graph.mmd -o graph.svg
# DOT → PNG/SVG (Graphviz)
dot -Tpng graph.dot -o graph.png
dot -Tsvg graph.dot -o graph.svg
コマンドオプション
| オプション | 説明 | デフォルト |
|---|---|---|
--db-path |
RyuGraphデータベースパス | ./knowledge.ryugraph |
--output-dir |
出力ディレクトリ | ./reports/graph/visualizations |
--format |
出力形式 (mermaid/dot/html/all) | all |
--domain |
フィルタするドメイン | なし(全て) |
--node-type |
フィルタするノードタイプ | なし(全て) |
--rel-type |
フィルタするリレーションタイプ | なし(全て) |
--max-nodes |
最大ノード数 | 100 |
--max-depth |
最大深さ | なし |
--layout |
レイアウト (LR/TB/RL/BT) | LR |
出力ファイル
reports/graph/visualizations/
├── graph.mmd # Mermaid形式
├── graph.dot # DOT形式(Graphviz)
├── graph.html # インタラクティブHTML
├── graph.png # PNG画像(mmdc使用時)
├── graph.svg # SVG画像
├── domain-audit.mmd # ドメイン別Mermaid
├── domain-identity.mmd
└── summary.md # 可視化サマリー
使用例
例1: 全体グラフの可視化
/visualize-graph ./reports/graph/visualizations
例2: 特定ドメインのみ
/visualize-graph --domain Audit
例3: エンティティ間の関係のみ
/visualize-graph --node-type Entity --rel-type REFERENCES
関連スキル
/build-graph- GraphDBを構築/query-graph- GraphDBを探索/render-mermaid- Mermaid図を画像に変換
Related Skills
Attack Tree Construction
Build comprehensive attack trees to visualize threat paths. Use when mapping attack scenarios, identifying defense gaps, or communicating security risks to stakeholders.
Grafana Dashboards
Create and manage production Grafana dashboards for real-time visualization of system and application metrics. Use when building monitoring dashboards, visualizing metrics, or creating operational observability interfaces.
Matplotlib
Foundational plotting library. Create line plots, scatter, bar, histograms, heatmaps, 3D, subplots, export PNG/PDF/SVG, for scientific visualization and publication figures.
Scientific Visualization
Create publication figures with matplotlib/seaborn/plotly. Multi-panel layouts, error bars, significance markers, colorblind-safe, export PDF/EPS/TIFF, for journal-ready scientific plots.
Seaborn
Statistical visualization. Scatter, box, violin, heatmaps, pair plots, regression, correlation matrices, KDE, faceted plots, for exploratory analysis and publication figures.
Shap
Model interpretability and explainability using SHAP (SHapley Additive exPlanations). Use this skill when explaining machine learning model predictions, computing feature importance, generating SHAP plots (waterfall, beeswarm, bar, scatter, force, heatmap), debugging models, analyzing model bias or fairness, comparing models, or implementing explainable AI. Works with tree-based models (XGBoost, LightGBM, Random Forest), deep learning (TensorFlow, PyTorch), linear models, and any black-box model
Pydeseq2
Differential gene expression analysis (Python DESeq2). Identify DE genes from bulk RNA-seq counts, Wald tests, FDR correction, volcano/MA plots, for RNA-seq analysis.
Query Writing
For writing and executing SQL queries - from simple single-table queries to complex multi-table JOINs and aggregations
Pydeseq2
Differential gene expression analysis (Python DESeq2). Identify DE genes from bulk RNA-seq counts, Wald tests, FDR correction, volcano/MA plots, for RNA-seq analysis.
Scientific Visualization
Meta-skill for publication-ready figures. Use when creating journal submission figures requiring multi-panel layouts, significance annotations, error bars, colorblind-safe palettes, and specific journal formatting (Nature, Science, Cell). Orchestrates matplotlib/seaborn/plotly with publication styles. For quick exploration use seaborn or plotly directly.
