# gom168/corenessmaximization architecture

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

- Interactive diagram: https://gitdiagram.com/gom168/corenessmaximization
- Repository: https://github.com/gom168/corenessmaximization

## Overview

Based on your file tree and README, the project is a C++ research implementation accompanying the paper “Coreness Maximization through Budget-Limited Edge Insertion.” Its purpose is to solve the Budget Limited Coreness Maximization Problem (BLCM) on network graphs by inserting edges strategically using several greedy algorithms (LCGI, GCGI, and LGB). The codebase is designed to compile with CMake and run via a shell script, taking input from provided dataset files and outputting experimental results.

##### Main components
- Input / Dataset Layer: Represent the “dataset” directory – this is where the network graph data (e.g. twitter_copen.txt) is stored.
- Graph Representation Component: The DataGraph.cpp and DataGraph.h files suggest a standalone class for building and managing the underlying graph structure.
- Partitioning Module: The Partition.cpp and Partition.h files likely implement part of the strategy (e.g., dividing the graph for more efficient processing).
- Orchestration / Control Unit ("Master"): The Master.cpp and Master.h files organize the algorithm execution by managing calls to the different greedy strategies.
- Core Algorithm Execution: Illustrate the three main algorithms – LCGI, GCGI, and LGB – as sub-components under the orchestration unit. Although not separated into different files, they are conceptually distinct and are executed as part of the program’s workflow.
- Main Application & Runner:
- main.cpp serves as the entry point where the program initializes and connects all the components.
- run.sh is the automation script that calls the built executable and might organize the multiple experimental runs and output handling.
- Build & Configuration:
- CMakeLists.txt is used to configure and build the project.
- Version control (.gitattributes) and documentation (README.md, fig folder with images) support the project’s maintenance and presentation.

##### Relationships and interactions
- Main (from main.cpp) instantiates the Master component, which in turn creates and manages a DataGraph instance to hold the network data.
- The Master component then invokes the core algorithm modules (the three greedy strategies) that work on the DataGraph and, where necessary, use the Partition module to optimize the computation.
- The results from these algorithms are then generated as output files (automatically created by the run.sh script), which may be fed back into analysis or visualization (see the fig folder images).

##### Architectural patterns and design principles
- Modular design: Each key functionality (graph representation, partitioning, algorithm orchestration) is separated into its own module, enhancing readability and maintainability.
- Layered processing: Data collection (input) flows through processing (graph & algorithms) before output generation. This separation clarifies dependencies between components.
- Use of object-oriented design in C++: Classes (e.g., DataGraph, Master, Partition) encapsulate state and behavior, facilitating focused interactions.

##### Incorporate relevant technologies and tools
- C++ as the programming language, using object-orientation.
- CMake for build configuration.
- Shell scripting (run.sh) for automated execution.
- Standard C++ libraries and likely implementations for data structures (graph nodes, edges) along with optimizations through -O3 during compilation.

- Use clear labels for each component:
- “Dataset Layer” for input files,
- “Graph Manager” (DataGraph),
- “Partition Module”,
- “Master/Controller” for coordinating algorithms,
- “Algorithm Modules” (LCGI, GCGI, LGB),
- “Output Generation” (results & figures).

## Diagram (Mermaid)

```mermaid
graph TD
    %% Input & Setup Layer
    subgraph "Input & Setup"
        A("Dataset Layer: twitter_copen.txt"):::input
        B("Entry Point: main.cpp"):::entry
        X("Runner: run.sh"):::runner
    end

    %% Build & Configuration Layer
    subgraph "Build & Configuration"
        K("CMakeLists.txt"):::build
        L(".gitattributes"):::build
        M("README.md"):::build
    end

    %% Processing Layer
    subgraph "Processing Layer"
        C("Graph Manager: DataGraph"):::processing
        D("Partition Module"):::processing
        E("Master/Controller"):::controller
            subgraph "Algorithm Modules"
                F("LCGI"):::algorithm
                G("GCGI"):::algorithm
                H("LGB"):::algorithm
            end
    end

    %% Output Generation
    I("Output Generation: Results & Figures"):::output

    %% Data Flow
    A -->|"ingests_data"| C
    B -->|"initializes"| E
    C -->|"provides_graph"| E
    D -->|"optimizes_data"| E
    E -->|"executes"| F
    E -->|"executes"| G
    E -->|"executes"| H
    F -->|"produces_output"| I
    G -->|"produces_output"| I
    H -->|"produces_output"| I
    X -->|"triggers_execution"| I

    %% Click Events
    click A "https://github.com/gom168/corenessmaximization/blob/main/dataset/twitter_copen.txt"
    click B "https://github.com/gom168/corenessmaximization/blob/main/main.cpp"
    click X "https://github.com/gom168/corenessmaximization/blob/main/run.sh"
    click C "https://github.com/gom168/corenessmaximization/blob/main/DataGraph.cpp"
    click D "https://github.com/gom168/corenessmaximization/blob/main/Partition.cpp"
    click E "https://github.com/gom168/corenessmaximization/blob/main/Master.cpp"
    click K "https://github.com/gom168/corenessmaximization/blob/main/CMakeLists.txt"
    click L "https://github.com/gom168/corenessmaximization/blob/main/.gitattributes"
    click M "https://github.com/gom168/corenessmaximization/blob/main/README.md"

    %% Styles
    classDef input fill:#ADD8E6,stroke:#000,stroke-width:2px;
    classDef entry fill:#E6E6FA,stroke:#000,stroke-width:2px;
    classDef runner fill:#FFD700,stroke:#000,stroke-width:2px;
    classDef build fill:#D3D3D3,stroke:#000,stroke-width:2px;
    classDef processing fill:#FFA07A,stroke:#000,stroke-width:2px;
    classDef controller fill:#90EE90,stroke:#000,stroke-width:2px;
    classDef algorithm fill:#DA70D6,stroke:#000,stroke-width:2px;
    classDef output fill:#98FB98,stroke:#000,stroke-width:2px;
```
