# khalil212002/causaldiscovery architecture

> Architecture diagram of the GitHub repository khalil212002/causaldiscovery, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/khalil212002/causaldiscovery
- Repository: https://github.com/khalil212002/causaldiscovery

## Overview

Causalitty is a desktop causal-discovery application for editing variable graphs and viewing conditional independencies implied by them. The principal workflow starts the Qt app, opens the graph editor, and lets users add variables and connect or remove relationships; the independencies screen derives and displays implied assertions from the scene’s graph. The graph model handles directed and undirected edges and validates conversion to a DAG. The README contains no product description, so capability coverage and connections here rely on the supplied source index and excerpts; several UI and rendering details are unsampled.

Main entry points: [`src/graph_editor/graph_node.py`](https://github.com/khalil212002/causaldiscovery/blob/main/src/graph_editor/graph_node.py) (Graph Node View), [`src/CPDAG/CPDAG.py`](https://github.com/khalil212002/causaldiscovery/blob/main/src/CPDAG/CPDAG.py) (CPDAG Operations), [`src/main.py`](https://github.com/khalil212002/causaldiscovery/blob/main/src/main.py) (App Startup), [`src/screens/splash_screen.py`](https://github.com/khalil212002/causaldiscovery/blob/main/src/screens/splash_screen.py) (Splash Screen)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application UI"]
  node_entry["App Startup<br/>[main.py]"]
  node_splash["Splash Screen<br/>[splash_screen.py]"]
  node_main["Main Screen<br/>[main_screen.py]"]
  node_independencies["Independencies View"]
end

subgraph group_editor["Graph Editor"]
  node_editor_window["Editor Window<br/>[graph_editor.py]"]
  node_editor_scene["Editor Scene"]
  node_cpdag_scene["CPDAG Scene"]
  node_graph_node["Graph Node View<br/>[graph_node.py]"]
  node_graph_arrow["Graph Arrow View<br/>[graph_arrow.py]"]
end

subgraph group_model["Causal Graph Model"]
  node_cpdag["CPDAG Operations<br/>[CPDAG.py]"]
  node_node["Variable Node<br/>[node.py]"]
  node_arrow["Graph Arrow<br/>[arrow.py]"]
end

subgraph group_shared["Shared UI Models"]
  node_var_types["Variable Types<br/>[var_types.py]"]
  node_var_colors["Type Colors<br/>[var_colors.py]"]
  node_ui_colors["UI Colors<br/>[ui_colors.py]"]
  node_app_info["App Settings<br/>[app_info.py]"]
end

node_user(("User"))

node_user -->|"launches"| node_entry
node_entry -->|"shows"| node_splash
node_entry -->|"opens"| node_main
node_entry -->|"loads steps"| node_app_info
node_main -->|"creates"| node_editor_window
node_main -->|"creates"| node_independencies
node_editor_window -->|"creates"| node_cpdag_scene
node_cpdag_scene -->|"uses"| node_editor_scene
node_cpdag_scene -->|"uses"| node_cpdag
node_editor_scene -->|"creates"| node_graph_node
node_editor_scene -->|"creates"| node_graph_arrow
node_graph_node -->|"extends"| node_node
node_graph_node -->|"uses"| node_var_types
node_graph_node -->|"uses"| node_var_colors
node_graph_node -->|"uses"| node_ui_colors
node_graph_arrow -->|"uses"| node_arrow
node_graph_arrow -->|"uses"| node_ui_colors
node_cpdag -->|"manages"| node_node
node_cpdag -->|"attaches"| node_arrow
node_cpdag -->|"classifies"| node_var_types
node_arrow -->|"links"| node_node
node_node -->|"stores type"| node_var_types
node_independencies -->|"derives assertions"| node_cpdag
node_independencies -.->|"observes changes"| node_editor_scene
node_splash -->|"uses"| node_ui_colors
node_splash -->|"reads labels"| node_app_info
node_splash -->|"uses"| node_var_colors

click node_entry "https://github.com/khalil212002/causaldiscovery/blob/main/src/main.py"
click node_splash "https://github.com/khalil212002/causaldiscovery/blob/main/src/screens/splash_screen.py"
click node_main "https://github.com/khalil212002/causaldiscovery/blob/main/src/screens/main_screen.py"
click node_independencies "https://github.com/khalil212002/causaldiscovery/blob/main/src/screens/independencies_screen.py"
click node_editor_window "https://github.com/khalil212002/causaldiscovery/blob/main/src/graph_editor/graph_editor.py"
click node_editor_scene "https://github.com/khalil212002/causaldiscovery/blob/main/src/graph_editor/graph_editor_scene.py"
click node_cpdag_scene "https://github.com/khalil212002/causaldiscovery/blob/main/src/graph_editor/CPDAG_editor_scene.py"
click node_graph_node "https://github.com/khalil212002/causaldiscovery/blob/main/src/graph_editor/graph_node.py"
click node_graph_arrow "https://github.com/khalil212002/causaldiscovery/blob/main/src/graph_editor/graph_arrow.py"
click node_cpdag "https://github.com/khalil212002/causaldiscovery/blob/main/src/CPDAG/CPDAG.py"
click node_node "https://github.com/khalil212002/causaldiscovery/blob/main/src/CPDAG/node.py"
click node_arrow "https://github.com/khalil212002/causaldiscovery/blob/main/src/CPDAG/arrow.py"
click node_var_types "https://github.com/khalil212002/causaldiscovery/blob/main/src/models/var_types.py"
click node_var_colors "https://github.com/khalil212002/causaldiscovery/blob/main/src/models/var_colors.py"
click node_ui_colors "https://github.com/khalil212002/causaldiscovery/blob/main/src/models/ui_colors.py"
click node_app_info "https://github.com/khalil212002/causaldiscovery/blob/main/src/models/app_info.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_entry,node_splash,node_main,node_independencies,node_user toneBlue
class node_editor_window,node_editor_scene,node_cpdag_scene,node_graph_node,node_graph_arrow toneAmber
class node_cpdag,node_node,node_arrow toneMint
class node_var_types,node_var_colors,node_ui_colors,node_app_info toneRose
```

## Components

### Application UI

- [App Startup](https://github.com/khalil212002/causaldiscovery/blob/main/src/main.py): `src/main.py`
- [Splash Screen](https://github.com/khalil212002/causaldiscovery/blob/main/src/screens/splash_screen.py): `src/screens/splash_screen.py`
- [Main Screen](https://github.com/khalil212002/causaldiscovery/blob/main/src/screens/main_screen.py): `src/screens/main_screen.py`
- [Independencies View](https://github.com/khalil212002/causaldiscovery/blob/main/src/screens/independencies_screen.py): `src/screens/independencies_screen.py`

### Graph Editor

- [Editor Window](https://github.com/khalil212002/causaldiscovery/blob/main/src/graph_editor/graph_editor.py): `src/graph_editor/graph_editor.py`
- [Editor Scene](https://github.com/khalil212002/causaldiscovery/blob/main/src/graph_editor/graph_editor_scene.py): `src/graph_editor/graph_editor_scene.py`
- [CPDAG Scene](https://github.com/khalil212002/causaldiscovery/blob/main/src/graph_editor/CPDAG_editor_scene.py): `src/graph_editor/CPDAG_editor_scene.py`
- [Graph Node View](https://github.com/khalil212002/causaldiscovery/blob/main/src/graph_editor/graph_node.py): `src/graph_editor/graph_node.py`
- [Graph Arrow View](https://github.com/khalil212002/causaldiscovery/blob/main/src/graph_editor/graph_arrow.py): `src/graph_editor/graph_arrow.py`

### Causal Graph Model

- [CPDAG Operations](https://github.com/khalil212002/causaldiscovery/blob/main/src/CPDAG/CPDAG.py): `src/CPDAG/CPDAG.py`
- [Variable Node](https://github.com/khalil212002/causaldiscovery/blob/main/src/CPDAG/node.py): `src/CPDAG/node.py`
- [Graph Arrow](https://github.com/khalil212002/causaldiscovery/blob/main/src/CPDAG/arrow.py): `src/CPDAG/arrow.py`

### Shared UI Models

- [Variable Types](https://github.com/khalil212002/causaldiscovery/blob/main/src/models/var_types.py): `src/models/var_types.py`
- [Type Colors](https://github.com/khalil212002/causaldiscovery/blob/main/src/models/var_colors.py): `src/models/var_colors.py`
- [UI Colors](https://github.com/khalil212002/causaldiscovery/blob/main/src/models/ui_colors.py): `src/models/ui_colors.py`
- [App Settings](https://github.com/khalil212002/causaldiscovery/blob/main/src/models/app_info.py): `src/models/app_info.py`

### Other components

- **User**

## Connections

- User → App Startup: launches
- App Startup → Splash Screen: shows (evidence: `src/main.py`)
- App Startup → Main Screen: opens (evidence: `src/main.py`)
- App Startup → App Settings: loads steps (evidence: `src/main.py`)
- Main Screen → Editor Window: creates (evidence: `src/screens/main_screen.py`)
- Main Screen → Independencies View: creates (evidence: `src/screens/main_screen.py`)
- Editor Window → CPDAG Scene: creates (evidence: `src/graph_editor/graph_editor.py`)
- CPDAG Scene → Editor Scene: uses (evidence: `src/graph_editor/CPDAG_editor_scene.py`)
- CPDAG Scene → CPDAG Operations: uses (evidence: `src/graph_editor/CPDAG_editor_scene.py`)
- Editor Scene → Graph Node View: creates (evidence: `src/graph_editor/graph_editor_scene.py`)
- Editor Scene → Graph Arrow View: creates (evidence: `src/graph_editor/graph_editor_scene.py`)
- Graph Node View → Variable Node: extends (evidence: `src/graph_editor/graph_node.py`)
- Graph Node View → Variable Types: uses (evidence: `src/graph_editor/graph_node.py`)
- Graph Node View → Type Colors: uses (evidence: `src/graph_editor/graph_node.py`)
- Graph Node View → UI Colors: uses (evidence: `src/graph_editor/graph_node.py`)
- Graph Arrow View → Graph Arrow: uses (evidence: `src/graph_editor/graph_arrow.py`)
- Graph Arrow View → UI Colors: uses (evidence: `src/graph_editor/graph_arrow.py`)
- CPDAG Operations → Variable Node: manages (evidence: `src/CPDAG/CPDAG.py`)
- CPDAG Operations → Graph Arrow: attaches (evidence: `src/CPDAG/CPDAG.py`)
- CPDAG Operations → Variable Types: classifies (evidence: `src/CPDAG/CPDAG.py`)
- Graph Arrow → Variable Node: links (evidence: `src/CPDAG/arrow.py`)
- Variable Node → Variable Types: stores type (evidence: `src/CPDAG/node.py`)
- Independencies View → CPDAG Operations: derives assertions (evidence: `src/screens/independencies_screen.py`)
- Independencies View → Editor Scene: observes changes
- Splash Screen → UI Colors: uses (evidence: `src/screens/splash_screen.py`)
- Splash Screen → App Settings: reads labels (evidence: `src/screens/splash_screen.py`)
- Splash Screen → Type Colors: uses (evidence: `src/screens/splash_screen.py`)
