{"id":18919033,"url":"https://github.com/alek-dr/graphlib","last_synced_at":"2026-03-12T11:30:22.174Z","repository":{"id":58933228,"uuid":"216021880","full_name":"Alek-dr/GraphLib","owner":"Alek-dr","description":"Graph library","archived":false,"fork":false,"pushed_at":"2024-04-03T15:20:20.000Z","size":256,"stargazers_count":0,"open_issues_count":4,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-12-31T15:54:48.456Z","etag":null,"topics":["bellman-ford-algorithm","bfs-algorithm","dfs","dijkstra-algorithm","graph","graph-algorithms","graphs","shortest-paths","topological-sort"],"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/Alek-dr.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":"2019-10-18T12:43:54.000Z","updated_at":"2024-08-14T03:18:48.000Z","dependencies_parsed_at":"2024-11-08T10:50:58.160Z","dependency_job_id":null,"html_url":"https://github.com/Alek-dr/GraphLib","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/Alek-dr%2FGraphLib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Alek-dr%2FGraphLib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Alek-dr%2FGraphLib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Alek-dr%2FGraphLib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Alek-dr","download_url":"https://codeload.github.com/Alek-dr/GraphLib/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239914942,"owners_count":19717760,"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":["bellman-ford-algorithm","bfs-algorithm","dfs","dijkstra-algorithm","graph","graph-algorithms","graphs","shortest-paths","topological-sort"],"created_at":"2024-11-08T10:34:41.567Z","updated_at":"2026-03-12T11:30:22.090Z","avatar_url":"https://github.com/Alek-dr.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GraphLib\n\nGraph library\n\nImplementation of different graph algorithms and representations.\n\nMinimalistic pure-python graph algorithms implementation\n\nImplemented algoritms:\n* DFS\n* BFS\n* Dijkstra\n* Bellman-Ford\n* Topological sort\n\nExample:  \nFind shortest paths for given graph from vertex S:  \n![alt text](tests/graph_images/graph_2.png)  \n```\nfrom core.algorithms import dijkstra\nfrom core.graphs import create_graph, Node\n\n\ndef create_test_graph():\n    graph = create_graph(directed=True)\n    nodeS = Node(\"S\")\n    nodeB = Node(\"B\")\n    nodeD = Node(\"D\")\n    nodeE = Node(\"E\")\n    nodeC = Node(\"C\")\n    nodeF = Node(\"F\")\n\n    graph.add_node(nodeS)\n    graph.add_node(nodeB)\n    graph.add_node(nodeD)\n    graph.add_node(nodeE)\n    graph.add_node(nodeC)\n    graph.add_node(nodeF)\n\n    graph.add_edge(\"S\", \"B\")\n    graph.add_edge(\"S\", \"D\")\n    graph.add_edge(\"B\", \"E\")\n    graph.add_edge(\"D\", \"E\")\n    graph.add_edge(\"B\", \"C\")\n    graph.add_edge(\"D\", \"F\")\n    graph.add_edge(\"C\", \"F\")\n    return graph\n\n\nif __name__ == '__main__':\n    graph = create_test_graph()\n    walks = dijkstra(graph, \"S\")\n    for v, w in walks.items():\n        print(f\"{v}: {w}\\tweight: {w.weight}\")\n```\nOutput:\n```\nE: S -\u003e (a) -\u003e B -\u003e (c) -\u003e E\tweight: 2\nF: S -\u003e (b) -\u003e D -\u003e (f) -\u003e F\tweight: 2\nC: S -\u003e (a) -\u003e B -\u003e (e) -\u003e C\tweight: 2\nB: S -\u003e (a) -\u003e B\tweight: 1\nD: S -\u003e (b) -\u003e D\tweight: 1\nS: S\tweight: 0\n```\n\n\n# Dependencies\nhttps://graphviz.org/download/\n\nGraphviz\n\n```\nsudo apt install graphviz\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falek-dr%2Fgraphlib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falek-dr%2Fgraphlib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falek-dr%2Fgraphlib/lists"}