{"id":31358314,"url":"https://github.com/leonsteinhaeuser/graph","last_synced_at":"2025-09-26T21:59:28.344Z","repository":{"id":42697076,"uuid":"494777177","full_name":"leonsteinhaeuser/graph","owner":"leonsteinhaeuser","description":"Graph implements a generic node graph data structure.","archived":false,"fork":false,"pushed_at":"2022-07-05T23:54:08.000Z","size":10,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-06-20T22:33:37.822Z","etag":null,"topics":[],"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/leonsteinhaeuser.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}},"created_at":"2022-05-21T12:28:58.000Z","updated_at":"2023-03-05T06:59:25.000Z","dependencies_parsed_at":"2022-08-27T04:50:14.656Z","dependency_job_id":null,"html_url":"https://github.com/leonsteinhaeuser/graph","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/leonsteinhaeuser/graph","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leonsteinhaeuser%2Fgraph","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leonsteinhaeuser%2Fgraph/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leonsteinhaeuser%2Fgraph/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leonsteinhaeuser%2Fgraph/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leonsteinhaeuser","download_url":"https://codeload.github.com/leonsteinhaeuser/graph/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leonsteinhaeuser%2Fgraph/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":277149974,"owners_count":25769492,"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","status":"online","status_checked_at":"2025-09-26T02:00:09.010Z","response_time":78,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2025-09-26T21:59:25.421Z","updated_at":"2025-09-26T21:59:28.338Z","avatar_url":"https://github.com/leonsteinhaeuser.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# graph\n\nGraph implements a generic node graph data structure. On top of the data structure, it provides the following methods:\n\n- AddChild(child *Node[id, v])\n- WalkDFS(f func(*Node[id, v]))\n- WalkBFS(f func(*Node[id, v]))\n- Order() map[int][]Node[id, v]\n- ID() id\n- Value() v\n- Weight() int\n\n## Example\n\n```go\npackage main\n\nimport (\n    \"fmt\"\n\n    \"github.com/leonsteinhaeuser/graph\"\n)\n\ntype NodePayload struct {\n    ID   int\n    Name string\n}\n\nfunc main() {\n    rootNode := graph.NewNode(\"A\", NodePayload{ID: 1, Name: \"root\"})\n    node1 := graph.NewNode(\"B\", NodePayload{ID: 2, Name: \"node1\"})\n    node2 := graph.NewNode(\"C\", NodePayload{ID: 3, Name: \"node2\"})\n\n    node3 := graph.NewNode(\"D\", NodePayload{ID: 4, Name: \"node3\"})\n    node4 := graph.NewNode(\"E\", NodePayload{ID: 5, Name: \"node4\"})\n    node5 := graph.NewNode(\"F\", NodePayload{ID: 6, Name: \"node5\"})\n\n    node1.AddChild(node3)\n    node1.AddChild(node4)\n    node2.AddChild(node5)\n    node3.AddChild(node5)\n\n    rootNode.AddChild(node1)\n    rootNode.AddChild(node2)\n\n    rootNode.WalkDFS(func(n *graph.Node[string, NodePayload]) {\n        fmt.Printf(\"%s: %v\\n\", n.ID(), n.Value())\n    })\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleonsteinhaeuser%2Fgraph","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleonsteinhaeuser%2Fgraph","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleonsteinhaeuser%2Fgraph/lists"}