# mjwybrow/adaptagrams architecture

> Architecture diagram of the GitHub repository mjwybrow/adaptagrams, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mjwybrow/adaptagrams
- Repository: https://github.com/mjwybrow/adaptagrams

## Overview

##### Main Components
- Layout Solver Engines:
– libvpsc: The core solver for quadratic programming problems, handling variable placement and separation constraints.
– libcola: The constraint graph layout engine that uses a stress-majorization method for non-overlapping and aesthetically pleasing graph layouts. (Note: libcola depends on libvpsc.)
- Connector and Routing:
- Topology and Extensions:
– libtopology: Adds topology-preserving capabilities for layout constraints. (This component depends on libavoid, libcola, and libvpsc.)
– libdialect: Implements a multi-step approach (Decompose/Distribute, Arrange, Expand/Emend, Transform) to achieve human-like orthogonal network layouts. (This depends on libavoid, libcola, and libvpsc.)
- Project and Utility Components:
– libproject: Contains additional utilities, tests and probably manages project configurations.
– libvpsc’s additional tests and example directories.
- Bindings and External Interfaces:
– The SWIG interfaces (see file “cola/adaptagrams.i” and swig-python-setup.py) support other languages.
– Experimental code (e.g., the experimental/ directories) that offer implementations, tests, or prototypes such as a Java-based rectangle overlap solver and other layout experiments.
- (Optional) External/Third-Party Modules:
– Although not a fully deployed service, there is also the “cola.js” effort that ports these ideas to JavaScript/D3.

##### Architectural Patterns and Design Principles
- The overall design showcases a modular and layered architecture where lower-level solver engines (libvpsc) provide core functionality that higher-level layout engines (libcola, libavoid) reuse and extend.
- There is a clear separation of concerns: each library focuses on a specific domain (solver, connector routing, topology) while dependencies are managed using the GNU automake build system.

##### Final Remarks
- That every module or library is represented with clear labels and arranged to make the interdependencies obvious.
- The separation into as many components as required to highlight dependency chains (e.g., from libvpsc to libcola, then to libdialect and libtopology) is recommended.
- Supplementary “binding” and “experimental” zones to reflect the breadth of the system beyond the core libraries.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Core Solver Layer
    subgraph "Core Solver"
        VPSC["libvpsc – Quadratic Constraint Solver"] 
    end

    %% Layout Engine Layer
    subgraph "Layout Engine"
        COLA["libcola – Graph Layout Engine"] 
    end

    %% Connector and Routing Layer
    subgraph "Routing Engine"
        AVOID["libavoid – Connector and Routing Engine"] 
    end

    %% Topology and Extensions Layer
    subgraph "Topology and Extensions"
        TOPO["libtopology – Topology Preserving Layout"]
        DIALECT["libdialect – Orthogonal Network Layout"]
        DOHLA["doHla Algorithm Module"]
    end

    %% Project and Utility Components
    subgraph "Project and Utilities"
        PROJECT["libproject – Project and Utility Components"]
    end

    %% Bindings and External Interfaces
    subgraph "Bindings and External"
        SWIG_I["SWIG: adaptagrams.i"]
        SWIG_PY["SWIG: swig-python-setup.py"]
        EXPERIMENTAL["Experimental Components – Prototypes and Alternative Implementations"]
    end

    %% Dependencies and Interactions
    VPSC -->|"depends"| COLA
    VPSC -->|"provides"| TOPO
    VPSC -->|"provides"| DIALECT

    COLA -->|"enhances"| TOPO
    COLA -->|"enhances"| DIALECT

    AVOID -->|"routes to"| TOPO
    AVOID -->|"routes to"| DIALECT

    DOHLA -->|"enhances"| COLA
    DOHLA -->|"enhances"| AVOID

    VPSC -->|"supports"| PROJECT

    SWIG_I -->|"calls"| VPSC
    SWIG_PY -->|"calls"| COLA

    %% Styles
    classDef core fill:#ffdead,stroke:#8b4513,stroke-width:2px;
    classDef layout fill:#add8e6,stroke:#00008b,stroke-width:2px;
    classDef connector fill:#90ee90,stroke:#006400,stroke-width:2px;
    classDef topology fill:#ffd700,stroke:#b8860b,stroke-width:2px;
    classDef experimental fill:#ffb6c1,stroke:#db7093,stroke-width:2px,stroke-dasharray: 5, 5;
    classDef utility fill:#d3d3d3,stroke:#696969,stroke-width:2px;
    classDef binding fill:#dda0dd,stroke:#9932cc,stroke-width:2px;

    %% Assign classes to nodes
    class VPSC core;
    class COLA layout;
    class AVOID connector;
    class TOPO,DIALECT topology;
    class DOHLA,EXPERIMENTAL experimental;
    class PROJECT utility;
    class SWIG_I,SWIG_PY binding;

    %% Click Events
    click VPSC "https://github.com/mjwybrow/adaptagrams/tree/master/cola/libvpsc"
    click COLA "https://github.com/mjwybrow/adaptagrams/tree/master/cola/libcola"
    click AVOID "https://github.com/mjwybrow/adaptagrams/tree/master/cola/libavoid"
    click TOPO "https://github.com/mjwybrow/adaptagrams/tree/master/cola/libtopology"
    click DIALECT "https://github.com/mjwybrow/adaptagrams/tree/master/cola/libdialect"
    click PROJECT "https://github.com/mjwybrow/adaptagrams/tree/master/cola/libproject"
    click SWIG_I "https://github.com/mjwybrow/adaptagrams/blob/master/cola/adaptagrams.i"
    click SWIG_PY "https://github.com/mjwybrow/adaptagrams/blob/master/cola/swig-python-setup.py"
    click EXPERIMENTAL "https://github.com/mjwybrow/adaptagrams/tree/master/experimental"
```
