{"id":16241327,"url":"https://github.com/lars-berger/graphy-ng","last_synced_at":"2025-03-19T16:31:48.158Z","repository":{"id":48363012,"uuid":"386356848","full_name":"lars-berger/graphy-ng","owner":"lars-berger","description":"Library for rendering directed graphs in Angular.","archived":false,"fork":false,"pushed_at":"2021-09-11T10:12:29.000Z","size":1300,"stargazers_count":28,"open_issues_count":0,"forks_count":2,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-02-28T19:55:44.507Z","etag":null,"topics":["angular","angular2","dagre","digraph","directed-graph","graph","svg","typescript"],"latest_commit_sha":null,"homepage":"https://lars-berger.github.io/graphy-ng","language":"TypeScript","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/lars-berger.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-07-15T16:30:26.000Z","updated_at":"2024-05-31T19:21:49.000Z","dependencies_parsed_at":"2022-09-05T15:10:11.663Z","dependency_job_id":null,"html_url":"https://github.com/lars-berger/graphy-ng","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lars-berger%2Fgraphy-ng","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lars-berger%2Fgraphy-ng/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lars-berger%2Fgraphy-ng/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lars-berger%2Fgraphy-ng/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lars-berger","download_url":"https://codeload.github.com/lars-berger/graphy-ng/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244006277,"owners_count":20382444,"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":["angular","angular2","dagre","digraph","directed-graph","graph","svg","typescript"],"created_at":"2024-10-10T14:07:09.129Z","updated_at":"2025-03-19T16:31:47.790Z","avatar_url":"https://github.com/lars-berger.png","language":"TypeScript","readme":"[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/lars-berger/graphy-ng/LICENSE.md)\n[![npm version](https://img.shields.io/npm/v/graphy-ng.svg?style=flat)](https://www.npmjs.com/package/graphy-ng)\n[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/lars-berger/graphy-ng/pulls)\n======\n\n[![graphy-ng logo](logo.png)](https://lars-berger.github.io/graphy-ng)\n\n`graphy-ng` is a library for rendering directed graphs in Angular. Under the hood, [Dagre](https://github.com/dagrejs/dagre) is used as a layout engine and the graph is drawn using SVGs.\n\n**The library is compiled with Ivy and requires Angular 12+**\n\n[📚 Documentation](https://lars-berger.github.io/graphy-ng)\n\n## Interactive example\n\nA simple interactive demo can be found on StackBlitz. It showcases how nodes and edges can be added dynamically and some features like making use of custom templates, re-rendering on create/update, and navigating the graph through panning or zooming.\n\n[⚡ StackBlitz link](https://stackblitz.com/github/lars-berger/graphy-ng/tree/main/example)\n\n![demo-recording](https://user-images.githubusercontent.com/34844898/128693533-a807ccfc-4d89-4e08-9f58-aca92b3cf0d8.gif)\n\n## Installation\n\nUsing npm:\n\n```\n$ npm i graphy-ng \u0026\u0026 npm i -D @types/d3-shape\n```\n\nUsing yarn:\n\n```\n$ yarn add graphy-ng \u0026\u0026 yarn add -D @types/d3-shape\n```\n\n## Basic usage\n\nImport `GraphyModule` into your feature module.\n\n`family-tree.module.ts`\n\n```ts\n@NgModule({\n  imports: [GraphyModule],\n  ...\n})\nexport class FamilyTreeModule {}\n```\n\nConsume `graphy-ng` in your component, providing templates for how nodes and edges should be rendered.\n\n`family-tree.component.html`\n\n```html\n\u003cp\u003eHere's my pretty graph:\u003c/p\u003e\n\u003cgraphy-ng\u003e\n  \u003cng-container *defsTemplate\u003e\n    \u003csvg:marker\n      id=\"arrow\"\n      viewBox=\"0 -5 10 10\"\n      refX=\"8\"\n      refY=\"0\"\n      markerWidth=\"4\"\n      markerHeight=\"4\"\n      orient=\"auto\"\n    \u003e\n      \u003csvg:path d=\"M0,-5L10,0L0,5\" /\u003e\n    \u003c/svg:marker\u003e\n  \u003c/ng-container\u003e\n\n  \u003cng-container *nodeTemplate=\"let node; nodes: nodes\"\u003e\n    \u003csvg:circle cx=\"25\" cy=\"25\" r=\"25\" /\u003e\n    \u003csvg:text fill=\"blue\" transform=\"translate(0 30)\"\u003e{{ node.data.name }}\u003c/svg:text\u003e\n  \u003c/ng-container\u003e\n\n  \u003cng-container *edgeTemplate=\"let edge; edges: edges\"\u003e\n    \u003csvg:path marker-end=\"url(#arrow)\" [attr.d]=\"edge.pathDefinition\"\u003e\u003c/svg:path\u003e\n  \u003c/ng-container\u003e\n\u003c/graphy-ng\u003e\n```\n\n`family-tree.component.ts`\n\n```ts\n@Component({\n  ...\n})\nexport class FamilyTreeComponent {\n  nodes: InputNode\u003c{ name: string }\u003e[] = [\n    { id: '1', data: { name: 'Carl' } },\n    { id: '2', data: { name: 'Robin' } },\n    { id: '3', data: { name: 'Jeremy' } },\n  ];\n\n  edges: InputEdge[] = [\n    { sourceId: '1', targetId: '3', },\n    { sourceId: '2', targetId: '3', },\n  ];\n}\n```\n\n## Comparison vs. [ngx-graph](https://github.com/swimlane/ngx-graph)\n\n**Pros:**\n\n- Significantly more lightweight. Production bundle size of a fresh Angular app decreased from `490kb` to `255kb` by switching libraries (**47% overall decrease** in app size).\n- Input nodes and edges are not modified by the library.\n- Avoids requiring certain CSS classes to be hard-coded when using custom templates.\n- Full TypeScript support when using custom templates.\n\n**Cons:**\n\n- Lacks more advanced and niche features — namely clusters, custom/force-directed layouts, and graph minimaps.\n\n## License\n\n`graphy-ng` is licensed under the terms of the [MIT License](https://github.com/lars-berger/graphy-ng/blob/main/LICENSE.md).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flars-berger%2Fgraphy-ng","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flars-berger%2Fgraphy-ng","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flars-berger%2Fgraphy-ng/lists"}