{"id":29358180,"url":"https://github.com/average-user/fruchterman-reingold","last_synced_at":"2025-10-14T22:37:29.301Z","repository":{"id":303191508,"uuid":"260838898","full_name":"Average-user/fruchterman-reingold","owner":"Average-user","description":"Implementation of Fruchterman-Reingold algorithm for directed force Graph Drawing","archived":false,"fork":false,"pushed_at":"2020-05-05T00:04:02.000Z","size":8764,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-06T08:44:00.067Z","etag":null,"topics":["algortihm","graph-drawing","graph-visualisation","graph-visualization","graphdrawing"],"latest_commit_sha":null,"homepage":"","language":"Clojure","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/Average-user.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":"2020-05-03T06:02:18.000Z","updated_at":"2020-06-05T21:02:18.000Z","dependencies_parsed_at":"2025-07-06T08:44:04.531Z","dependency_job_id":"7b0b309d-6cab-4738-a0c2-40cf707def21","html_url":"https://github.com/Average-user/fruchterman-reingold","commit_stats":null,"previous_names":["average-user/fruchterman-reingold"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Average-user/fruchterman-reingold","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Average-user%2Ffruchterman-reingold","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Average-user%2Ffruchterman-reingold/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Average-user%2Ffruchterman-reingold/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Average-user%2Ffruchterman-reingold/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Average-user","download_url":"https://codeload.github.com/Average-user/fruchterman-reingold/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Average-user%2Ffruchterman-reingold/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264403827,"owners_count":23602623,"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":["algortihm","graph-drawing","graph-visualisation","graph-visualization","graphdrawing"],"created_at":"2025-07-09T06:08:56.671Z","updated_at":"2025-10-14T22:37:24.251Z","avatar_url":"https://github.com/Average-user.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Fruchterman-Reingold algorithm for directed force Graph drawing\n\nThis implementation is not focused on performance, but in experimenting\nwith this relatively simple algorithm, and visualising its process.\n\n## Main Idea\n\nThe idea of a Graph drawing is simply to take a graph and display it on a\nscreen in a \"pleasing\" way whatever this means. The way that Fruchterman and\nReingold approach this, is to think vertices as particles in space\nthat exert repulsive force to the others and attractive force\nto the ones that are connected by some edge.\n\n## Visualisation\nLive visualisation is implemented with [quil](http://www.quil.info/). Here\nare some examples of starting positions (random) and resulting ones:\n\n#### [Dürer Graph](https://en.wikipedia.org/wiki/D%C3%BCrer_graph)\n![Starting Position](images/DurerStart.png) ![Result](images/DurerResult.png)\n![Gif](images/Durer.gif)\n\n#### [K7](https://en.wikipedia.org/wiki/Complete_graph)\n![Starting Position](images/K7Start.png) ![Result](images/K7Result.png)\n\n#### Twin K5\n![Starting Position](images/Twin5Start.png) ![Result](images/Twin5Result.png)\n\n\n#### Random Graph of 10 vertices. [Generated with p=0.41, seed=-957442595]\n![Starting Position](images/Rand10Start.png) ![Result](images/Rand10Result.png)\n![Gif](images/Rand10.gif)\n\n#### Random Graph of 20 vertices. [Generated with p=0.15, seed=-173247684]\n![Starting Position](images/Rand20Start.png) ![Result](images/Rand20Result.png)\n![Gif](images/Rand20.gif)\n\n## Usage\n\nExecute with\n\n```\nlein run\n```\n\nIn order to try out other graphs is likely that you only need to change some of\nthe following lines of [core.clj](https://github.com/Average-user/fruchterman-reingold/blob/master/src/fruchterman_reingold/core.clj):\n\n``` clojure\n(def W 600)\n(def H 600)\n(def line-weight 3)\n(def node-radius 15)\n\n(defn setup []\n  (q/ellipse-mode :center)\n  (q/frame-rate 60)\n  {:states (al/fruchterman-reingold g/Durer (- W 30) (- H 30) 0.7)\n   ;; We need to make with and height a little smaller since in the actual drawing\n   ;; points have area i.e are not really points\n   :i -50})\n```\n`W` (width), `H` (height), `line-weight`, `node-radius` and `frame-rate` all\nexplain themselves. The first of the `al/fruchterman-reingold` arguments\nis the graph (undirected) to be drawn, to exemplify how is that we represent\ngraphs, here's the complete graph of three vertices:\n\n```Clojure\n{:V #{:a :b :c}\n :E #{#{:a :b} #{:a :c} #{:b :c}}}\n```\nYou can either try out some of the graphs in [graphs.clj](https://github.com/Average-user/fruchterman-reingold/blob/master/src/fruchterman_reingold/graphs.clj)\nor create your own. In the later case some important observations are that the graph must be\nconnected and that the elements do not need to be keywords, since we are only\ninterested in the structural properties of a graph and not its content.\n\nThe last argument (`0.7` as default) is the ideal edge length coefficient `C`.\nFruchterman and Reingold approximate the ideal length of edges as `C*sqrt(W*H/|V|)`,\nin some cases if we set `C` too small the graph will look too dense, and if we\nset it too large It will run out of space.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faverage-user%2Ffruchterman-reingold","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faverage-user%2Ffruchterman-reingold","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faverage-user%2Ffruchterman-reingold/lists"}