# wl-1001/knowledge-graph-driven-network-scenario-construction architecture

> Architecture diagram of the GitHub repository wl-1001/knowledge-graph-driven-network-scenario-construction, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/wl-1001/knowledge-graph-driven-network-scenario-construction
- Repository: https://github.com/wl-1001/knowledge-graph-driven-network-scenario-construction

## Overview

The repository builds a CVE knowledge graph in Neo4j, then uses that graph to generate network scenarios for penetration-testing simulation. The documented workflow selects operating systems and vulnerabilities, assigns services and exploit outcomes, accounts for network topology and leaked credentials, and assembles node configurations into an environment. The graph distinguishes CSV ingestion from scenario-time graph lookup and generation. The imported simulation model is not present in the supplied tree, so its internal behavior is not mapped.

Main entry points: [`generate_scenario.py`](https://github.com/wl-1001/knowledge-graph-driven-network-scenario-construction/blob/main/generate_scenario.py) (Node design), [`cve_knowledgegraph.py`](https://github.com/wl-1001/knowledge-graph-driven-network-scenario-construction/blob/main/cve_knowledgegraph.py) (Graph ingestion), [`cve_for_neo4j.csv`](https://github.com/wl-1001/knowledge-graph-driven-network-scenario-construction/blob/main/cve_for_neo4j.csv) (CVE dataset)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_kg["Knowledge graph"]
  node_cve_data["CVE dataset<br/>[cve_for_neo4j.csv]"]
  node_ingestion["Graph ingestion"]
end

subgraph group_scenario["Scenario construction"]
  node_graph_lookup["Graph lookup"]
  node_os_vuln["OS and vulnerabilities"]
  node_node_design["Node design"]
  node_topology["Network topology"]
  node_exploit_outcomes["Exploit outcomes"]
  node_node_config["Node configuration"]
  node_environment["Simulation environment"]
end

subgraph group_integration["External systems"]
  node_neo4j[("Neo4j graph")]
  node_simulation_model["Simulation model"]
end

node_operator(("Operator"))

node_operator -.->|"runs ingestion"| node_ingestion
node_cve_data -->|"provides records"| node_ingestion
node_ingestion -->|"writes graph"| node_neo4j
node_operator -.->|"runs generation"| node_graph_lookup
node_graph_lookup -->|"queries graph"| node_neo4j
node_graph_lookup -->|"selects OS and CVEs"| node_os_vuln
node_node_design -->|"gets node properties"| node_graph_lookup
node_node_design -->|"creates topology"| node_topology
node_node_design -->|"assigns outcomes"| node_exploit_outcomes
node_node_design -->|"assembles node data"| node_node_config
node_node_design -->|"builds environment"| node_environment
node_environment -->|"uses model types"| node_simulation_model

click node_cve_data "https://github.com/wl-1001/knowledge-graph-driven-network-scenario-construction/blob/main/cve_for_neo4j.csv"
click node_ingestion "https://github.com/wl-1001/knowledge-graph-driven-network-scenario-construction/blob/main/cve_knowledgegraph.py"
click node_graph_lookup "https://github.com/wl-1001/knowledge-graph-driven-network-scenario-construction/blob/main/generate_scenario.py"
click node_os_vuln "https://github.com/wl-1001/knowledge-graph-driven-network-scenario-construction/blob/main/generate_scenario.py"
click node_node_design "https://github.com/wl-1001/knowledge-graph-driven-network-scenario-construction/blob/main/generate_scenario.py"
click node_topology "https://github.com/wl-1001/knowledge-graph-driven-network-scenario-construction/blob/main/generate_scenario.py"
click node_exploit_outcomes "https://github.com/wl-1001/knowledge-graph-driven-network-scenario-construction/blob/main/generate_scenario.py"
click node_node_config "https://github.com/wl-1001/knowledge-graph-driven-network-scenario-construction/blob/main/generate_scenario.py"
click node_environment "https://github.com/wl-1001/knowledge-graph-driven-network-scenario-construction/blob/main/generate_scenario.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_cve_data,node_ingestion toneBlue
class node_graph_lookup,node_os_vuln,node_node_design,node_topology,node_exploit_outcomes,node_node_config,node_environment toneAmber
class node_neo4j,node_simulation_model toneMint
class node_operator toneIndigo
```

## Components

### Knowledge graph

- [CVE dataset](https://github.com/wl-1001/knowledge-graph-driven-network-scenario-construction/blob/main/cve_for_neo4j.csv): `cve_for_neo4j.csv`
- [Graph ingestion](https://github.com/wl-1001/knowledge-graph-driven-network-scenario-construction/blob/main/cve_knowledgegraph.py): `cve_knowledgegraph.py`

### Scenario construction

- [Graph lookup](https://github.com/wl-1001/knowledge-graph-driven-network-scenario-construction/blob/main/generate_scenario.py): `generate_scenario.py`
- [OS and vulnerabilities](https://github.com/wl-1001/knowledge-graph-driven-network-scenario-construction/blob/main/generate_scenario.py): `generate_scenario.py`
- [Node design](https://github.com/wl-1001/knowledge-graph-driven-network-scenario-construction/blob/main/generate_scenario.py): `generate_scenario.py`
- [Network topology](https://github.com/wl-1001/knowledge-graph-driven-network-scenario-construction/blob/main/generate_scenario.py): `generate_scenario.py`
- [Exploit outcomes](https://github.com/wl-1001/knowledge-graph-driven-network-scenario-construction/blob/main/generate_scenario.py): `generate_scenario.py`
- [Node configuration](https://github.com/wl-1001/knowledge-graph-driven-network-scenario-construction/blob/main/generate_scenario.py): `generate_scenario.py`
- [Simulation environment](https://github.com/wl-1001/knowledge-graph-driven-network-scenario-construction/blob/main/generate_scenario.py): `generate_scenario.py`

### External systems

- **Neo4j graph**
- **Simulation model**

### Other components

- **Operator**

## Connections

- Operator → Graph ingestion: runs ingestion
- CVE dataset → Graph ingestion: provides records (evidence: `cve_knowledgegraph.py`)
- Graph ingestion → Neo4j graph: writes graph (evidence: `cve_knowledgegraph.py`)
- Operator → Graph lookup: runs generation
- Graph lookup → Neo4j graph: queries graph (evidence: `generate_scenario.py`)
- Graph lookup → OS and vulnerabilities: selects OS and CVEs (evidence: `generate_scenario.py`)
- Node design → Graph lookup: gets node properties (evidence: `generate_scenario.py`)
- Node design → Network topology: creates topology (evidence: `generate_scenario.py`)
- Node design → Exploit outcomes: assigns outcomes (evidence: `generate_scenario.py`)
- Node design → Node configuration: assembles node data (evidence: `generate_scenario.py`)
- Node design → Simulation environment: builds environment (evidence: `generate_scenario.py`)
- Simulation environment → Simulation model: uses model types (evidence: `generate_scenario.py`)
