# nsnam/ns-3-dev-git architecture

> Architecture diagram of the GitHub repository nsnam/ns-3-dev-git, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/nsnam/ns-3-dev-git
- Repository: https://github.com/nsnam/ns-3-dev-git

## Overview

ns-3 is a discrete-event network simulator for research and education. A user writes a C++ or Python simulation, configures the simulator and selected model libraries, and runs it to produce simulation traces or other results. The graph highlights the runtime layers and major modeling capabilities evident in the tree, including internet routing, Wi-Fi, applications, and optional MPI and real-device emulation. Source excerpts are limited, so most cross-library relationships are included only where the README or SOURCE INDEX documents them.

Main entry points: [`src/core/model/simulator.cc`](https://github.com/nsnam/ns-3-dev-git/blob/master/src/core/model/simulator.cc) (Core runtime), [`src/internet/model/ipv4-l3-protocol.h`](https://github.com/nsnam/ns-3-dev-git/blob/master/src/internet/model/ipv4-l3-protocol.h) (Internet stack), [`src/wifi/model/he/he-frame-exchange-manager.cc`](https://github.com/nsnam/ns-3-dev-git/blob/master/src/wifi/model/he/he-frame-exchange-manager.cc) (Wi-Fi MAC and PHY), [`src/internet/model/global-route-manager-impl.cc`](https://github.com/nsnam/ns-3-dev-git/blob/master/src/internet/model/global-route-manager-impl.cc) (Global routing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_authoring["Simulation authoring"]
  node_cpp["C++ program"]
  node_python["Python program"]
  node_bindings["Python bindings<br/>[ns__init__.py]"]
end

subgraph group_runtime["Simulation runtime"]
  node_core["Core runtime<br/>[simulator.cc]"]
  node_scheduler["Event scheduling"]
  node_random["Random streams"]
end

subgraph group_network["Network stack"]
  node_networkstack["Internet stack<br/>[ipv4-l3-protocol.h]"]
  node_ipv6["IPv6 stack<br/>[ipv6-l3-protocol.h]"]
  node_globalrouting["Global routing"]
  node_aodv["AODV routing"]
  node_dsr["DSR routing<br/>[dsr-routing.cc]"]
  node_olsr["OLSR routing"]
end

subgraph group_models["Network models"]
  node_wifi["Wi-Fi MAC and PHY"]
  node_station["Wi-Fi station control"]
  node_applications["Traffic applications"]
  node_antenna["Antenna models<br/>[antenna-model.cc]"]
  node_buildings["Building propagation"]
end

subgraph group_extensions["Extensions and observation"]
  node_mpi["MPI coordination"]
  node_emulation["Real-device emulation<br/>[fd-net-device.cc]"]
  node_flowmonitor["Flow monitoring<br/>[flow-monitor.cc]"]
  node_visualizer["Network visualization"]
end

node_user(("Simulation author"))
node_results["Simulation output"]

node_user -->|"writes"| node_cpp
node_user -->|"writes"| node_python
node_python -->|"uses"| node_bindings
node_cpp -->|"links"| node_core
node_python -->|"imports"| node_core
node_cpp -->|"selects models"| node_networkstack
node_cpp -->|"selects models"| node_wifi
node_core -.->|"schedules events"| node_scheduler
node_core -.->|"uses streams"| node_random
node_globalrouting -->|"reads routes"| node_networkstack
node_aodv -.->|"implements routing"| node_networkstack
node_dsr -.->|"implements routing"| node_networkstack
node_olsr -.->|"implements routing"| node_networkstack
node_station -->|"provides station state"| node_wifi
node_applications -.->|"uses simulator"| node_core
node_mpi -->|"coordinates simulation"| node_core
node_emulation -->|"connects host packets"| node_networkstack
node_flowmonitor -.->|"reports flows"| node_results
node_visualizer -.->|"displays topology"| node_results
node_core -->|"produces traces"| node_results

click node_bindings "https://github.com/nsnam/ns-3-dev-git/blob/master/bindings/python/ns__init__.py"
click node_core "https://github.com/nsnam/ns-3-dev-git/blob/master/src/core/model/simulator.cc"
click node_scheduler "https://github.com/nsnam/ns-3-dev-git/blob/master/src/core/model/default-simulator-impl.cc"
click node_random "https://github.com/nsnam/ns-3-dev-git/blob/master/src/core/model/rng-seed-manager.cc"
click node_networkstack "https://github.com/nsnam/ns-3-dev-git/blob/master/src/internet/model/ipv4-l3-protocol.h"
click node_ipv6 "https://github.com/nsnam/ns-3-dev-git/blob/master/src/internet/model/ipv6-l3-protocol.h"
click node_globalrouting "https://github.com/nsnam/ns-3-dev-git/blob/master/src/internet/model/global-route-manager-impl.cc"
click node_aodv "https://github.com/nsnam/ns-3-dev-git/blob/master/src/aodv/model/aodv-routing-protocol.cc"
click node_dsr "https://github.com/nsnam/ns-3-dev-git/blob/master/src/dsr/model/dsr-routing.cc"
click node_olsr "https://github.com/nsnam/ns-3-dev-git/blob/master/src/olsr/model/olsr-routing-protocol.cc"
click node_wifi "https://github.com/nsnam/ns-3-dev-git/blob/master/src/wifi/model/he/he-frame-exchange-manager.cc"
click node_station "https://github.com/nsnam/ns-3-dev-git/blob/master/src/wifi/model/wifi-remote-station-manager.cc"
click node_applications "https://github.com/nsnam/ns-3-dev-git/blob/master/src/applications/model/three-gpp-http-client.cc"
click node_antenna "https://github.com/nsnam/ns-3-dev-git/blob/master/src/antenna/model/antenna-model.cc"
click node_buildings "https://github.com/nsnam/ns-3-dev-git/blob/master/src/buildings/model/buildings-propagation-loss-model.cc"
click node_mpi "https://github.com/nsnam/ns-3-dev-git/blob/master/src/mpi/model/remote-channel-bundle-manager.cc"
click node_emulation "https://github.com/nsnam/ns-3-dev-git/blob/master/src/fd-net-device/model/fd-net-device.cc"
click node_flowmonitor "https://github.com/nsnam/ns-3-dev-git/blob/master/src/flow-monitor/model/flow-monitor.cc"
click node_visualizer "https://github.com/nsnam/ns-3-dev-git/blob/master/src/visualizer/visualizer/plugins/ipv4_routing_table.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_cpp,node_python,node_bindings toneBlue
class node_core,node_scheduler,node_random toneAmber
class node_networkstack,node_ipv6,node_globalrouting,node_aodv,node_dsr,node_olsr toneMint
class node_wifi,node_station,node_applications,node_antenna,node_buildings toneRose
class node_mpi,node_emulation,node_flowmonitor,node_visualizer,node_user,node_results toneIndigo
```

## Components

### Simulation authoring

- **C++ program**
- **Python program**
- [Python bindings](https://github.com/nsnam/ns-3-dev-git/blob/master/bindings/python/ns__init__.py): `bindings/python/ns__init__.py`

### Simulation runtime

- [Core runtime](https://github.com/nsnam/ns-3-dev-git/blob/master/src/core/model/simulator.cc): `src/core/model/simulator.cc`
- [Event scheduling](https://github.com/nsnam/ns-3-dev-git/blob/master/src/core/model/default-simulator-impl.cc): `src/core/model/default-simulator-impl.cc`
- [Random streams](https://github.com/nsnam/ns-3-dev-git/blob/master/src/core/model/rng-seed-manager.cc): `src/core/model/rng-seed-manager.cc`

### Network stack

- [Internet stack](https://github.com/nsnam/ns-3-dev-git/blob/master/src/internet/model/ipv4-l3-protocol.h): `src/internet/model/ipv4-l3-protocol.h`
- [IPv6 stack](https://github.com/nsnam/ns-3-dev-git/blob/master/src/internet/model/ipv6-l3-protocol.h): `src/internet/model/ipv6-l3-protocol.h`
- [Global routing](https://github.com/nsnam/ns-3-dev-git/blob/master/src/internet/model/global-route-manager-impl.cc): `src/internet/model/global-route-manager-impl.cc`
- [AODV routing](https://github.com/nsnam/ns-3-dev-git/blob/master/src/aodv/model/aodv-routing-protocol.cc): `src/aodv/model/aodv-routing-protocol.cc`
- [DSR routing](https://github.com/nsnam/ns-3-dev-git/blob/master/src/dsr/model/dsr-routing.cc): `src/dsr/model/dsr-routing.cc`
- [OLSR routing](https://github.com/nsnam/ns-3-dev-git/blob/master/src/olsr/model/olsr-routing-protocol.cc): `src/olsr/model/olsr-routing-protocol.cc`

### Network models

- [Wi-Fi MAC and PHY](https://github.com/nsnam/ns-3-dev-git/blob/master/src/wifi/model/he/he-frame-exchange-manager.cc): `src/wifi/model/he/he-frame-exchange-manager.cc`
- [Wi-Fi station control](https://github.com/nsnam/ns-3-dev-git/blob/master/src/wifi/model/wifi-remote-station-manager.cc): `src/wifi/model/wifi-remote-station-manager.cc`
- [Traffic applications](https://github.com/nsnam/ns-3-dev-git/blob/master/src/applications/model/three-gpp-http-client.cc): `src/applications/model/three-gpp-http-client.cc`
- [Antenna models](https://github.com/nsnam/ns-3-dev-git/blob/master/src/antenna/model/antenna-model.cc): `src/antenna/model/antenna-model.cc`
- [Building propagation](https://github.com/nsnam/ns-3-dev-git/blob/master/src/buildings/model/buildings-propagation-loss-model.cc): `src/buildings/model/buildings-propagation-loss-model.cc`

### Extensions and observation

- [MPI coordination](https://github.com/nsnam/ns-3-dev-git/blob/master/src/mpi/model/remote-channel-bundle-manager.cc): `src/mpi/model/remote-channel-bundle-manager.cc`
- [Real-device emulation](https://github.com/nsnam/ns-3-dev-git/blob/master/src/fd-net-device/model/fd-net-device.cc): `src/fd-net-device/model/fd-net-device.cc`
- [Flow monitoring](https://github.com/nsnam/ns-3-dev-git/blob/master/src/flow-monitor/model/flow-monitor.cc): `src/flow-monitor/model/flow-monitor.cc`
- [Network visualization](https://github.com/nsnam/ns-3-dev-git/blob/master/src/visualizer/visualizer/plugins/ipv4_routing_table.py): `src/visualizer/visualizer/plugins/ipv4_routing_table.py`

### Other components

- **Simulation author**
- **Simulation output**

## Connections

- Simulation author → C++ program: writes (evidence: `README.md`)
- Simulation author → Python program: writes (evidence: `README.md`)
- Python program → Python bindings: uses (evidence: `README.md`)
- C++ program → Core runtime: links (evidence: `README.md`)
- Python program → Core runtime: imports (evidence: `README.md`)
- C++ program → Internet stack: selects models (evidence: `README.md`)
- C++ program → Wi-Fi MAC and PHY: selects models (evidence: `README.md`)
- Core runtime → Event scheduling: schedules events
- Core runtime → Random streams: uses streams
- Global routing → Internet stack: reads routes (evidence: `src/internet/model/global-route-manager-impl.cc`)
- AODV routing → Internet stack: implements routing
- DSR routing → Internet stack: implements routing
- OLSR routing → Internet stack: implements routing
- Wi-Fi station control → Wi-Fi MAC and PHY: provides station state (evidence: `src/wifi/model/wifi-remote-station-manager.cc`)
- Traffic applications → Core runtime: uses simulator
- MPI coordination → Core runtime: coordinates simulation (evidence: `README.md`)
- Real-device emulation → Internet stack: connects host packets (evidence: `README.md`)
- Flow monitoring → Simulation output: reports flows
- Network visualization → Simulation output: displays topology
- Core runtime → Simulation output: produces traces (evidence: `README.md`)
