{"id":25762458,"url":"https://github.com/GregoryKogan/evo-layout","last_synced_at":"2026-08-06T12:30:32.555Z","repository":{"id":277073756,"uuid":"931160816","full_name":"GregoryKogan/evo-layout","owner":"GregoryKogan","description":"A high-performance, modular Go library for exploring hybrid genetic algorithms (SGA, NSGA-II, SPEA2, FR-NSGA2) applied to multi-objective graph layout and other optimization problems.","archived":false,"fork":false,"pushed_at":"2025-08-25T14:31:27.000Z","size":108878,"stargazers_count":14,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2026-03-06T10:56:33.144Z","etag":null,"topics":["evolutionary-computation","genetic-algorithm","go","golang","graph-drawing","graph-layout","mephi","multi-objective-optimization","nsga-ii","nsga2","optimization-library","research-project","spea2"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/GregoryKogan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-02-11T20:15:12.000Z","updated_at":"2026-02-27T07:06:11.000Z","dependencies_parsed_at":null,"dependency_job_id":"6bcb534a-7950-4630-90ce-7ea2cfbd5d46","html_url":"https://github.com/GregoryKogan/evo-layout","commit_stats":null,"previous_names":["gregorykogan/genetic-algorithms","gregorykogan/evo-layout"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/GregoryKogan/evo-layout","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GregoryKogan%2Fevo-layout","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GregoryKogan%2Fevo-layout/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GregoryKogan%2Fevo-layout/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GregoryKogan%2Fevo-layout/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GregoryKogan","download_url":"https://codeload.github.com/GregoryKogan/evo-layout/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GregoryKogan%2Fevo-layout/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":36336257,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-08-06T04:43:03.162Z","status":"ssl_error","status_checked_at":"2026-08-06T04:43:02.660Z","response_time":54,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["evolutionary-computation","genetic-algorithm","go","golang","graph-drawing","graph-layout","mephi","multi-objective-optimization","nsga-ii","nsga2","optimization-library","research-project","spea2"],"created_at":"2025-02-26T19:53:04.253Z","updated_at":"2026-08-06T12:30:32.530Z","avatar_url":"https://github.com/GregoryKogan.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# EvoLayout: A Go Library for Hybrid Genetic Algorithms\n\n[![Static Badge](https://img.shields.io/badge/The%20Research%20Paper-blue?style=for-the-badge\u0026logo=googledocs\u0026logoColor=white\u0026logoSize=auto\u0026label=%20Read)](paper.pdf)\n\nA high-performance, modular Go library for exploring and applying genetic algorithms, with a special focus on multi-objective graph layout optimization. This project is the artifact of the research paper \"Development of a system implementing a genetic algorithm and its application to the arrangement of graph vertices on a plane.\"\n\n\u003cp align=\"center\"\u003e\n  \u003cimg alt=\"Animation showing the layout process for a 200-vertex planar graph using the FR-NSGA2 hybrid algorithm\" src=\"https://github.com/GregoryKogan/GregoryKogan/blob/4b380cdd26bf43603a0521440122e2a3f614014a/readme_assets/gp-200-planar-FR-NSGA2.gif\" /\u003e\n  \n  \u003ci align=\"center\"\u003eAnimation showing the layout process for a 200-vertex planar graph using the FR-NSGA2 hybrid algorithm\u003c/i\u003e\n\u003c/p\u003e\n\n---\n\n## Table of Contents\n\n- [About The Project](#about-the-project)\n- [Key Features](#sparkles-key-features)\n- [Getting Started](#rocket-getting-started)\n  - [Prerequisites](#prerequisites)\n  - [Installation](#installation)\n- [Quick Start](#runner-quick-start)\n- [Project Structure](#open_file_folder-project-structure)\n- [Implemented Algorithms \u0026 Problems](#wrench-implemented-algorithms--problems)\n  - [Genetic Algorithms](#genetic-algorithms)\n  - [Genetic Operators](#genetic-operators)\n  - [Optimization Problems](#optimization-problems)\n- [Key Results \u0026 Visualizations](#bar_chart-key-results--visualizations)\n- [License](#scroll-license)\n- [Acknowledgments](#pray-acknowledgments)\n\n## About The Project\n\nModern optimization problems are often multi-criteria and combinatorially complex, rendering traditional methods inefficient. Graph layout is a prime example: creating a clear, readable visualization of a graph is a multi-objective challenge that involves minimizing edge crossings, ensuring uniform vertex distribution, and optimizing angles.\n\nThis library was developed to tackle this challenge by exploring **hybrid genetic algorithms**. It provides a flexible, extensible, and high-performance framework for implementing, testing, and comparing various evolutionary computation techniques. While its primary focus is graph layout, the modular architecture allows it to solve other classic optimization problems like the Traveling Salesperson Problem (TSP) and the Knapsack Problem.\n\nThe core of this research demonstrates that hybrid approaches, particularly the custom **FR-NSGA2** algorithm, can significantly outperform both classic genetic algorithms and standalone force-directed methods, especially for large, complex graphs.\n\n## :sparkles: Key Features\n\n- **Hybrid Algorithms:** Implements novel hybrid methods that combine the strengths of force-directed placement (Fruchterman-Reingold) and multi-objective genetic algorithms (NSGA-II).\n- **Rich Operator Toolkit:** Provides a comprehensive suite of **12+ specialized genetic operators**, including standard, problem-specific, and adaptive mutation/crossover functions.\n- **Modular \u0026 Extensible Architecture:** Designed around clean Go interfaces (`Problem`, `Solution`). Easily add new algorithms, problems, or operators without modifying the core library.\n- **Classic \u0026 Modern GAs:** Includes implementations of SGA, SSGA, NSGA-II, and SPEA2 for comparative analysis.\n- **Built-in Problem Suite:** Comes with ready-to-use implementations for Graph Layout, Traveling Salesperson Problem (TSP), 0-1 Knapsack Problem, and the ZDT test suite for multi-objective optimization.\n- **Performance-Oriented:** Written in Go for high performance and low memory footprint, capable of handling graphs with hundreds of vertices efficiently.\n\n## :rocket: Getting Started\n\n### Prerequisites\n\n- **Go:** Version 1.23 or later.\n\n### Installation\n\nTo add the library to your project, use `go get`:\n\n```bash\ngo get github.com/GregoryKogan/genetic-algorithms\n```\n\n## :runner: Quick Start\n\nHere's a simple example of how to use the library to solve a graph layout problem using the high-performing `FR-NSGA2` hybrid method.\n\n```go\npackage main\n\nimport (\n \"context\"\n \"fmt\"\n \"time\"\n\n \"github.com/GregoryKogan/genetic-algorithms/pkg/algos/nsga2\"\n \"github.com/GregoryKogan/genetic-algorithms/pkg/problems/graphplane\"\n \"github.com/GregoryKogan/genetic-algorithms/pkg/problems/graphplane/operators/crossover\"\n \"github.comcom/GregoryKogan/genetic-algorithms/pkg/problems/graphplane/operators/mutation\"\n)\n\nfunc main() {\n // 1. Define the problem: A planar graph with 50 vertices\n problem := graphplane.NewPlanarGraphPlaneProblem(50)\n\n // 2. Configure the hybrid algorithm FR-NSGA2\n // Phase 1: Force-Directed (Fruchterman-Reingold)\n frParams := graphplane.FDSParams{\n  Steps: 2000,\n  Temp:  0.005,\n  K:     0.6, // Optimal K for this graph size\n }\n // Phase 2: NSGA-II\n nsga2Params := nsga2.Params{\n  PopulationSize: 500,\n  CrossoverFunc:  crossover.Uniform(0.4),\n  MutationFunc:   mutation.ConservativeNorm(0.1),\n }\n nsga2GenerationLimit := 350\n\n // 3. Run the hybrid algorithm\n fmt.Println(\"Starting FR-NSGA2 optimization...\")\n startTime := time.Now()\n\n // Run FR phase\n frSolver := graphplane.NewForceDirectedSolver(problem.RandomSolution(), frParams, nil)\n frSolution := frSolver.Solve()\n\n // Run NSGA-II phase, seeding it with the result from FR\n ga := nsga2.NewAlgorithm(problem, nsga2Params, nsga2GenerationLimit, nil)\n ga.Seed(frSolution.Solution) // Seed with the best solution from the FR phase\n \n // Set a timeout for the optimization process\n ctx, cancel := context.WithTimeout(context.Background(), 10*time.Minute)\n defer cancel()\n ga.Run(ctx)\n \n finalSolution := ga.GetSolution()\n elapsed := time.Since(startTime)\n\n // 4. Print the results\n fmt.Printf(\"Optimization finished in %v\\n\", elapsed)\n fmt.Printf(\"Final Solution Objectives: %v\\n\", finalSolution.Objectives())\n}\n```\n\n## :open_file_folder: Project Structure\n\nThe library is organized into a clear, modular structure within the `pkg/` directory.\n\n```plaintext\npkg/\n├── algos/                # Core genetic algorithm implementations\n│   ├── nsga2/\n│   ├── sga/\n│   ├── spea2/\n│   └── ssga/\n├── problems/             # Problem definitions and solutions\n│   ├── graphplane/       # Graph Layout problem\n│   │   └── operators/    # Specialized crossover and mutation operators\n│   ├── knapsack/         # 0-1 Knapsack problem\n│   ├── tsp/              # Traveling Salesperson Problem\n│   └── zdt/              # ZDT benchmark functions\n└── visual/                 # Scripts for generating visualizations\n```\n\n- **`pkg/algos`**: Contains the implementations of different genetic algorithms (SGA, NSGA-II, etc.). They all work with the generic `problems.Solution` interface.\n- **`pkg/problems`**: Defines the core interfaces (`Problem`, `Solution`) and contains sub-packages for each implemented optimization problem.\n- **`cmd/`**: Contains example executables for running experiments.\n- **`visual/`**: Contains Python and p5.js scripts used to generate the charts and animations from the research paper.\n\n## :wrench: Implemented Algorithms \u0026 Problems\n\n### Genetic Algorithms\n\n| Algorithm | Type | Key Feature |\n| :--- | :--- | :--- |\n| **SGA** | Single-Objective | Simple, generational model. |\n| **SSGA** | Single-Objective | Steady-state model, replaces worst individuals. |\n| **NSGA-II** | Multi-Objective | Fast non-dominated sorting and crowding distance. |\n| **SPEA2** | Multi-Objective | Strength-based fitness and density estimation. |\n| **FR-NSGA2** | Multi-Objective, Hybrid | Uses Force-Directed placement for a fast start, then NSGA-II for refinement. **(Best performer)** |\n| **SSGA-FR** | Single-Objective, Hybrid | Uses SSGA for initial layout, then FR for local optimization. |\n| **FR-SSGA-NSGA2** | Multi-Objective, Hybrid | A three-phase approach combining all three methods. |\n\n### Genetic Operators\n\nA rich set of crossover and mutation operators is provided, especially for the graph layout problem.\n\n| Operator Type | Name | Description |\n| :--- | :--- | :--- |\n| **Crossover** | Uniform Crossover | Exchanges genes between parents based on a probability. |\n| **Mutation** | Uniform, Normal, Mirror, Percentage | Standard operators for exploration and exploitation. |\n| **Fixed Mutation** | Fixed Uniform/Normal/Percentage | **Целенаправленные:** Apply mutation only to vertices involved in edge crossings. |\n| **Hybrid Mutation** | Tension Vector (TV), Fixed TV | Incorporates force-directed principles into the mutation step. |\n| **Adaptive Mutation** | Adaptive Normal, Conservative Normal | Change behavior based on the state of the solution (e.g., presence of crossings). |\n\n### Optimization Problems\n\n| Problem | Type | Description |\n| :--- | :--- | :--- |\n| **Graph Layout** | Multi-Objective | Minimize edge crossings, maximize vertex/angle uniformity. |\n| **Knapsack (0-1)** | Single-Objective | Maximize total value within resource constraints. |\n| **TSP** | Single-Objective | Find the shortest possible route that visits each city once. |\n| **ZDT Suite** | Multi-Objective | Benchmark functions (ZDT1, 2, 3, 4, 6) for testing MOEAs. |\n\n## :bar_chart: Key Results \u0026 Visualizations\n\nThe experimental results demonstrate the significant advantage of the hybrid **FR-NSGA2** algorithm.\n\n\u003cp align=\"center\"\u003e\n  \u003cimg alt=\"Edge Crossings Comparison Chart\" src=\"https://github.com/user-attachments/assets/cb25d202-04bf-4ec1-84a3-f70521c8e387\" /\u003e\n  \n  \u003ci align=\"center\"\u003eComparison of average edge crossings across all algorithms and graph sizes. Lower is better. The hybrid `FR-NSGA2` (dark blue) consistently outperforms others.\u003c/i\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cimg alt=\"Untangled Solutions Comparison Chart\" src=\"https://github.com/user-attachments/assets/36480d24-ed36-4e1c-9854-66bc45e701d1\" /\u003e\n  \n  \u003ci align=\"center\"\u003ePercentage of Successfully Untangled Solutions. This chart compares the ability of different algorithms to achieve a perfect planar embedding (0 edge crossings) for planar graphs of increasing size. The results dramatically illustrate the superiority of the hybrid FR-NSGA2 algorithm, which is the only method that consistently finds planar layouts for large graphs (100 and 200 vertices).\u003c/i\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cimg alt=\"ZDT1-SSGA\" src=\"https://github.com/user-attachments/assets/d06c8d3e-e5e4-4124-87ea-c042aa3f1ade\" width=49% /\u003e\n  \u003cimg alt=\"ZDT1-NSGA2\" src=\"https://github.com/user-attachments/assets/4f9745a3-9a60-4424-93a3-521576f29093\" width=49% /\u003e\n\n  \u003ci align=\"center\"\u003eSolution of ZDT1 problem by Single-Objective SSGA (left) and Multi-Objective NSGA-II (right)\u003c/i\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cimg alt=\"TSP-100\" src=\"https://github.com/user-attachments/assets/5045c41d-c2a5-4e33-8a78-4b17205a2a9d\" width=49% /\u003e\n  \n  \u003ci align=\"center\"\u003eAn example solution for a 100-city Traveling Salesperson Problem found by the SSGA algorithm.\u003c/i\u003e\n\u003c/p\u003e\n\n## :scroll: License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.\n\n## :pray: Acknowledgments\n\nThis project is based on the undergraduate research paper completed at the **National Research Nuclear University MEPhI (Moscow Engineering Physics Institute)**.\n\n- **Author:** Gregory Koganovsky\n- **Supervisor:** M.A. Korotkova, Ph.D., Associate Professor\n\nA special thanks to the faculty of the Department of Cybernetics (No. 22) for their guidance and support.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FGregoryKogan%2Fevo-layout","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FGregoryKogan%2Fevo-layout","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FGregoryKogan%2Fevo-layout/lists"}