{"id":24886364,"url":"https://github.com/mzguntalan/spring","last_synced_at":"2025-10-12T21:42:34.504Z","repository":{"id":253533643,"uuid":"843651790","full_name":"mzguntalan/spring","owner":"mzguntalan","description":"Implementation of \"Graph Drawing by Force-directed Placement\" by Frutcherman and Reingold in 1991 using the jit-jax. This repo interprets the procedural/step-by-step nature of the algorithm into a matrix and gpu-friendly manner.","archived":false,"fork":false,"pushed_at":"2024-08-17T12:52:34.000Z","size":10,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-01T15:14:47.807Z","etag":null,"topics":["graph","graph-algorithms","graphdrawing","jax","network"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mzguntalan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2024-08-17T02:40:16.000Z","updated_at":"2024-09-19T06:40:53.000Z","dependencies_parsed_at":"2024-08-17T13:57:14.189Z","dependency_job_id":"cfaf0eb4-74a1-4a3c-a91a-276236cf2a61","html_url":"https://github.com/mzguntalan/spring","commit_stats":null,"previous_names":["mzguntalan/spring"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mzguntalan%2Fspring","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mzguntalan%2Fspring/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mzguntalan%2Fspring/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mzguntalan%2Fspring/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mzguntalan","download_url":"https://codeload.github.com/mzguntalan/spring/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245825251,"owners_count":20678531,"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":["graph","graph-algorithms","graphdrawing","jax","network"],"created_at":"2025-02-01T15:14:51.009Z","updated_at":"2025-10-12T21:42:29.456Z","avatar_url":"https://github.com/mzguntalan.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# spring\n\nImplementation of \"Graph Drawing by Force-directed Placement\" by Frutcherman and Reingold in 1991\nusing the jit-jax. This repo interprets the procedural/step-by-step nature of the algorithm\ninto a matrix and gpu-friendly manner. \n\nThis algorithm is used almost everywhere you see beautiful graph/networks like from networkx.\n\nMost of the procedures and formulae have been merged into the equation below.\n\nFor a Graph $G = \u003cV, E\u003e$, let $\\Delta = V[None,:,:] - V[:, None,:]$ pairwise vectors from $i$ to $j$ for any $\\Delta_{ij}$.\n\nThe attractive displacement is $F_A = \\frac{E \\Delta |\\Delta|}{k}$ and the repulsive displacement is $F_R = -\\frac{\\Delta k^2}{ |\\Delta|^2}$. And the total displament for each pairwise interactions is $D$.\n\n$$D = \\frac{E\\Delta|\\Delta|^3 - \\Delta k^3}{k |\\Delta|^2}$$\n\nAt this point $D \\in \\mathbb{R}^{n \\times n \\times 2}$ and shows the displacement contribution of each pair of nodes. $d = \\Sigma_j D_j$ where $d \\in \\mathbb{R}^{n \\times 2}$ is the raw update vector for V. \n\nThe last part of the algorithm is to cap the updates in either the $x$ or $y$ direction by the temperature $\\tau$ at time $t$.\n\n\nHyperparameters of this algorithm include the number of steps, initializations, and the cooling function for determining the temperature. \n\n## Demonstrations\n\nThe gifs take a while to start (because of recording). The speed is intentionally slow for demonstration.\n\n![animation](https://github.com/mzguntalan/media_for_other_repo/blob/main/spring/d1.gif?raw=true)\n![animation](https://github.com/mzguntalan/media_for_other_repo/blob/main/spring/d2.gif?raw=true)\n![animation](https://github.com/mzguntalan/media_for_other_repo/blob/main/spring/d3.gif?raw=true)\n![animation](https://github.com/mzguntalan/media_for_other_repo/blob/main/spring/d4.gif?raw=true)\n![animation](https://github.com/mzguntalan/media_for_other_repo/blob/main/spring/d5.gif?raw=true)\n![animation](https://github.com/mzguntalan/media_for_other_repo/blob/main/spring/d6.gif?raw=true)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmzguntalan%2Fspring","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmzguntalan%2Fspring","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmzguntalan%2Fspring/lists"}