# graphistry/pygraphistry architecture

> Architecture diagram of the GitHub repository graphistry/pygraphistry, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/graphistry/pygraphistry
- Repository: https://github.com/graphistry/pygraphistry

## Overview

##### Main Components

a. Core Components:
- Plotter Engine (core visualization system)
- GFQL (Graph Query Language System)
- Compute Engine (Analytics & AI)
- Layout Engine
- Plugin System
- API Client Layer

b. External Integrations:
- GPU Acceleration Services
- Database Connectors
- Visualization Server
- External Computing Services

**┌─ Client Layer ─────────────────────────────────────────┐**
- Python API Interface                                 │
- Configuration Management                             │
- ┘
- ↕
**┌─ Core Processing Layer ────────────────────────────────┐**
- ┌─ Query Engine ─┐ ┌─ Compute Engine ┐ ┌─ Layout Engine ┐│
- GFQL     │ │ - Graph Analytics│ │ - Positioning  ││
- AST      │ │ - ML/AI          │ │ - Rendering    ││
- ┘ └────────────────┘ └───────────────┘│
- ┘
- ↕
**┌─ Plugin Layer ──────────────────────────────────────────┐**
- ┌─ Database ─┐ ┌─ Compute ─┐ ┌─ Visualization ┐        │
- Neo4j    │ │ - RAPIDS  │ │ - Graphistry   │        │
- Neptune  │ │ - cuGraph │ │   Server       │        │
- ┘ └──────────┘ └───────────────┘        │
- ┘
- ↕
**┌─ Infrastructure Layer ─────────────────────────────────┐**
- GPU Acceleration                                     │
- Data Storage                                         │
- Network Communication                                │
- ┘

##### Component Relationships

- Data flow between components
- Dependencies between layers
- Plugin integration points
- API communication paths

##### Additional Elements

- Version compatibility information
- Data format transformations
- Security boundaries

##### Implementation Details

- graphistry/compute/ for computation components
- graphistry/layout/ for layout engines
- graphistry/plugins/ for integration points
- graphistry/tests/ for testing architecture

##### Performance Flows

Separate flows for:
- Standard CPU processing
- GPU-accelerated processing
- Hybrid processing modes

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client["Client Layer"]
        API[Python API Interface]:::client
        Config[Configuration Management]:::client
    end

    subgraph Core["Core Processing Layer"]
        subgraph QueryEngine["Query Engine"]
            GFQL[GFQL Processor]:::core
            AST[AST Parser]:::core
        end

        subgraph ComputeEngine["Compute Engine"]
            Analytics[Graph Analytics]:::core
            Clustering[Clustering]:::core
            Filtering[Filtering]:::core
        end

        subgraph LayoutEngine["Layout Engine"]
            FA2[Force Atlas 2]:::core
            Circle[Circle Layout]:::core
            GIB[Group-in-Box]:::core
            Ring[Ring Layouts]:::core
        end
    end

    subgraph Plugins["Plugin Layer"]
        subgraph DB["Database Plugins"]
            Neo4j[Neo4j Connector]:::plugin
            TigerGraph[TigerGraph]:::plugin
            Gremlin[Gremlin]:::plugin
        end

        subgraph Compute["Compute Plugins"]
            RAPIDS[RAPIDS]:::plugin
            cuGraph[cuGraph]:::plugin
        end

        subgraph Viz["Visualization"]
            GraphistryServer[Graphistry Server]:::plugin
        end
    end

    subgraph Infra["Infrastructure Layer"]
        GPU[GPU Acceleration]:::infra
        Storage[Data Storage]:::infra
        Network[Network Communication]:::infra
    end

    %% Relationships
    API --> GFQL
    API --> Analytics
    Config --> API
    GFQL --> AST
    Analytics --> Clustering
    Analytics --> Filtering
    Analytics --> FA2
    Analytics --> Circle
    Analytics --> GIB
    Analytics --> Ring
    Neo4j --> Storage
    TigerGraph --> Storage
    Gremlin --> Storage
    RAPIDS --> GPU
    cuGraph --> GPU
    GraphistryServer --> Network

    %% Click Events
    click GFQL "https://github.com/graphistry/pygraphistry/tree/master/graphistry/compute/"
    click AST "https://github.com/graphistry/pygraphistry/blob/master/graphistry/compute/ast.py"
    click Analytics "https://github.com/graphistry/pygraphistry/blob/master/graphistry/compute/ComputeMixin.py"
    click Clustering "https://github.com/graphistry/pygraphistry/blob/master/graphistry/compute/cluster.py"
    click Filtering "https://github.com/graphistry/pygraphistry/blob/master/graphistry/compute/filter_by_dict.py"
    click FA2 "https://github.com/graphistry/pygraphistry/blob/master/graphistry/layout/fa2.py"
    click Circle "https://github.com/graphistry/pygraphistry/blob/master/graphistry/layout/circle.py"
    click GIB "https://github.com/graphistry/pygraphistry/tree/master/graphistry/layout/gib/"
    click Ring "https://github.com/graphistry/pygraphistry/tree/master/graphistry/layout/ring/"
    click Neo4j "https://github.com/graphistry/pygraphistry/blob/master/graphistry/bolt_util.py"
    click TigerGraph "https://github.com/graphistry/pygraphistry/blob/master/graphistry/tigeristry.py"
    click Gremlin "https://github.com/graphistry/pygraphistry/blob/master/graphistry/gremlin.py"
    click cuGraph "https://github.com/graphistry/pygraphistry/blob/master/graphistry/plugins/cugraph.py"

    %% Styles
    classDef client fill:#3498db,stroke:#2980b9,stroke-width:2px
    classDef core fill:#2ecc71,stroke:#27ae60,stroke-width:2px
    classDef plugin fill:#e67e22,stroke:#d35400,stroke-width:2px
    classDef infra fill:#95a5a6,stroke:#7f8c8d,stroke-width:2px

    %% Legend
    subgraph Legend
        Client_L[Client Components]:::client
        Core_L[Core Components]:::core
        Plugin_L[Plugin Components]:::plugin
        Infra_L[Infrastructure]:::infra
    end
```
