{"id":16088565,"url":"https://github.com/halidodat/arrayvisualization","last_synced_at":"2025-10-05T22:08:24.060Z","repository":{"id":116627381,"uuid":"505072775","full_name":"HalidOdat/ArrayVisualization","owner":"HalidOdat","description":"An array algorithm visualization program written in C#","archived":false,"fork":false,"pushed_at":"2022-07-03T21:59:28.000Z","size":638,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-11T12:45:26.277Z","etag":null,"topics":["algorithm-visualizer","array","csharp","sorting-visualization","visualization"],"latest_commit_sha":null,"homepage":"","language":"C#","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/HalidOdat.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}},"created_at":"2022-06-19T10:06:42.000Z","updated_at":"2023-03-19T20:03:41.000Z","dependencies_parsed_at":null,"dependency_job_id":"cb748998-1066-4e4d-8e52-b9ecb470c4a9","html_url":"https://github.com/HalidOdat/ArrayVisualization","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HalidOdat%2FArrayVisualization","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HalidOdat%2FArrayVisualization/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HalidOdat%2FArrayVisualization/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HalidOdat%2FArrayVisualization/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HalidOdat","download_url":"https://codeload.github.com/HalidOdat/ArrayVisualization/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247361700,"owners_count":20926643,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["algorithm-visualizer","array","csharp","sorting-visualization","visualization"],"created_at":"2024-10-09T13:36:57.622Z","updated_at":"2025-10-05T22:08:19.041Z","avatar_url":"https://github.com/HalidOdat.png","language":"C#","readme":"# Array Algorithm Visualizer\n\nAn array algorithm visualization program written in C#. It currently support two visualization modes and 19 algorithms.\n\n## Demo\n\nArray Length: 700 elements, shuffled, sorted by the Cocktail (Shaker) algorithm.\n\n![Demo GIF](./screenshots/demo.gif)\n\n## Usage\n\nThe UI is divided into two parts the controls and the draw area, as seen below:\n![Program Overview](./screenshots/program_overview.png)\n\nThe control section holds 3 sections: `Visualization Mode`, `Visualization Properties` and `Algorithms`.\n\n### Visualization Modes\n\n![Visualization Modes](./screenshots/modes_side_by_side.jpg)\n\nCurrently this visualizer supports 2 modes: `Bars` and `Points`. The modes can be cycled through with the `Ctrl-M` (keybinding see `Keybinding` section below).\n\n### Visualization Properties\n\nThe visualization properties can be changed in the control panel, such as whether to display them with color, the length of the array, the speed of visualizaion (`Up` and `Down` keys) and pausing (which can also be done through the `Space` key).\n\n### Algorithms\n\nThis section of the control panel contains all the currently implemented algorithms. They can be swiched at any time in the visualization process (The current algorithm doesn't have to finish).\n\n### Keybindings\n\n| Key           | Description                                 |\n| ------------- | ------------------------------------------- |\n| Space         | Pauses/Resumes the current Algorithm        |\n| Ctrl-M        | Switches between the visualization modes    |\n| Ctrl-S        | Shuffles the array (Fisher-Yates algorithm) |\n| Up            | Decreases the delay between algorithm steps |\n| Down          | Increases the delay between algorithm steps |\n\n## Implementing a new algorithm\n\nAll agorithms inherit from the base `Algorithm` class.\n\n```csharp\n    /// \u003csummary\u003e\n    /// This abstract class represents an argorithm, all algorithms must inherit from this class.\n    /// \n    /// It implements the the IEnumerable and IEnumerator interfaces returning an Algorithm state on enumeration,\n    /// which represents the steps the algorithm takes.\n    /// \u003c/summary\u003e\n    public abstract class Algorithm : IEnumerable\u003cAlgorithmState\u003e, IEnumerator\u003cAlgorithmState\u003e\n    {\n        /// \u003csummary\u003e\n        /// An abstract constructor of the Algorithm class.\n        /// \u003c/summary\u003e\n        /// \u003cparam name=\"name\"\u003eThe name of the algorithm\u003c/param\u003e\n        /// \u003cparam name=\"array\"\u003eThe array that is manipulated\u003c/param\u003e\n        public Algorithm(string name, Array array)\n        {\n            this.Name = name;\n            this.Array = array;\n        }\n\n        /// \u003csummary\u003e\n        /// This methods must be override by all algorithms that inherit from this class.\n        /// \n        /// It represent the actual algorithm. When you want to record the state of the algorithm,\n        /// you must `yield return` the state. Which will pause the execution of the method and return.\n        /// When called again it will continue where it left off.\n        /// \u003c/summary\u003e\n        /// \u003creturns\u003e\u003c/returns\u003e\n        protected abstract IEnumerator\u003cAlgorithmState\u003e CreateEnumerator();\n    }\n```\n\nThe new algorithm must override the `CreateEnumerator()` method.\n\n```csharp\n    public class MyAlgorithmAlgorithm : Algorithm\n    {\n        public MyAlgorithmAlgorithm(Array array) : base(\"My Algorithm Name\", array)\n        {\n        }\n\n        protected override IEnumerator\u003cAlgorithmState\u003e CreateEnumerator()\n        {\n            for (int i = 0; i \u003c= Array.Count - 2; i++)\n            {\n                yield return new AlgorithmState(new List\u003cint\u003e() { i }); // Record step\n                // ... Do some small step ...\n                yield return new AlgorithmState(new List\u003cint\u003e() { i }); // Record step\n            }\n\n            yield break; // End algorithm.\n        }\n    }\n```\n\nOn each step record we `yield return` a new `AlgorithmStep` which holds the indices that point in the array. And in the end you can optionaly call `yield break`.\n\n## Quick Start\n\nClone the project:\n```bash\ngit clone https://github.com/HalidOdat/ArrayVisualization.git\n```\nAnd open the `ArrayVisualization.sln` solution file in Visual Studio.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhalidodat%2Farrayvisualization","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhalidodat%2Farrayvisualization","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhalidodat%2Farrayvisualization/lists"}