{"id":26142283,"url":"https://github.com/lamberta/graphael","last_synced_at":"2025-07-22T17:34:03.452Z","repository":{"id":280214951,"uuid":"941312435","full_name":"lamberta/graphael","owner":"lamberta","description":"Graph data structures and algorithms for Emacs Lisp","archived":false,"fork":false,"pushed_at":"2025-03-10T21:29:45.000Z","size":72,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-10T22:28:37.042Z","etag":null,"topics":["emacs","emacs-lisp"],"latest_commit_sha":null,"homepage":"","language":"Emacs Lisp","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lamberta.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}},"created_at":"2025-03-02T01:40:42.000Z","updated_at":"2025-03-10T21:29:49.000Z","dependencies_parsed_at":"2025-03-02T03:19:19.046Z","dependency_job_id":null,"html_url":"https://github.com/lamberta/graphael","commit_stats":null,"previous_names":["lamberta/graphael"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/lamberta/graphael","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lamberta%2Fgraphael","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lamberta%2Fgraphael/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lamberta%2Fgraphael/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lamberta%2Fgraphael/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lamberta","download_url":"https://codeload.github.com/lamberta/graphael/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lamberta%2Fgraphael/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266539300,"owners_count":23944989,"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-07-22T02:00:09.085Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"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":["emacs","emacs-lisp"],"created_at":"2025-03-11T03:42:22.838Z","updated_at":"2025-07-22T17:34:03.234Z","avatar_url":"https://github.com/lamberta.png","language":"Emacs Lisp","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Graphael - Graph Library for Emacs\n\nGraphael is an object-based graph data structure library for Emacs Lisp\nthat provides a useful API to create, manipulate, and analyze directed\ngraphs. Features include:\n\n- UUID-based node and edge identification\n- Directed graph representation with weighted edges\n- Store arbitrary metadata on nodes and edges\n- Efficient adjacency lookup with pre-computed indices\n- Graph operations to merge, clone, and extract a subgraph\n- Algorithms such as pathfinding, cycle detection, and topological sort\n- Extensive test coverage and usage examples\n\n## Install\n\nClone the repository:\n\n```bash\n$ git clone https://github.com/lamberta/graphael.git\n```\n\nLoad the library in your Emacs Lisp project:\n\n```elisp\n(add-to-list 'load-path \"/path/to/graphael\")\n(require 'graphael)\n```\n\n## Basic usage\n\n### Create a graph and add nodes\n\n```elisp\n;; Create a new graph\n(setq g (make-instance 'graph))\n\n;; Add nodes\n(setq node1 (graph-node-add g :label \"Start\"))\n(setq node2 (graph-node-add g :label \"Middle\"))\n(setq node3 (graph-node-add g :label \"End\"))\n\n;; Add edges between nodes\n(setq edge1 (graph-edge-add g :from node1 :to node2))\n(setq edge2 (graph-edge-add g :from node2 :to node3 :weight 2.5))\n\n;; Add metadata to nodes/edges\n(graph-node-attr-put node1 :category \"entry-point\")\n(graph-edge-attr-put edge2 :requires-permission t)\n```\n\n### Get node information\n\n```elisp\n;; Get a node by its ID\n(setq retrieved-node (graph-node-get g (node-id node1)))\n\n;; Get node properties\n(node-label retrieved-node)  ; =\u003e \"Start\"\n(graph-node-attr-get retrieved-node :category)  ; =\u003e \"entry-point\"\n\n;; Get connected nodes (neighbors)\n(graph-neighbors g (node-id node1))    ; =\u003e List of successor nodes\n(graph-neighbors g (node-id node2) t)  ; =\u003e List of predecessor nodes\n```\n\n## Advanced usage\n\n### Find shortest path\n\n```elisp\n(cl-multiple-value-bind (path distance)\n  ;; Use Dijkstra's algorithm\n  (graph-find-path-shortest g node1 node3)\n  (message \"Length: %d nodes, Distance: %.1f\" (length path) distance))\n```\n\n### Find path between nodes using A*\n\n```elisp\n;; Assume grid layout and set (x . y) coordinates for each node\n(graph-node-attr-put node1 :coords '(0 . 0))\n(graph-node-attr-put node2 :coords '(2 . 3))\n(graph-node-attr-put node3 :coords '(5 . 3))\n\n;; Create the Manhattan distance heuristic function\n(let ((heuristic (graph-astar-manhattan-distance g\n                   (lambda (node)\n                     \"Helper function to extract coordinates from a node\"\n                     (graph-node-attr-get node :coords)))))\n  (cl-multiple-value-bind (path distance)\n    (graph-find-path-astar g node1 node3 heuristic)\n    (message \"Length: %d nodes, Distance: %.1f\" (length path) distance)))\n```\n\n### Graph operations\n\n```elisp\n;; Create a copy of a graph\n(setq g2 (graph-clone g))\n\n;; Create a subgraph containing only specific nodes\n(setq subgraph (graph-subgraph g2 (list node1 node2)))\n\n;; Create a subgraph using a filter function\n(setq filtered-graph (graph-subgraph g\n                       (lambda (node)\n                         (string-prefix-p \"Start\" (node-label node)))))\n\n;; Merge two graphs (returns a new graph by default)\n(setq merged-graph (graph-merge g g2))\n\n;; Merge graphs in-place (modifies first graph)\n(graph-merge g g2 t)\n```\n\n### Graph analysis\n\n```elisp\n;; Detect cycles in a graph\n(when (graph-cycle-p g)\n  (message \"Graph contains at least one cycle\"))\n\n;; Check if graph is connected\n(graph-is-connected-p g)\n\n;; Perform topological sort (for DAGs)\n(graph-topological-sort g)\n\n;; Get graph statistics\n(graph-print-stats g)\n```\n\n### Transaction safety\n\n```elisp\n;; Execute multiple operations atomically\n(with-graph-transaction (g)\n  (graph-node-remove g node1)\n  (graph-node-add g :label \"Replacement\"))\n```\n\n## Developer commands\n\nByte-compile Elisp files for compilation warnings:\n\n```bash\n$ make\n```\n\nRun tests:\n\n```bash\n$ make test\n```\n\nUse a different version of Emacs:\n\n```bash\n$ EMACS=/path/to/bin/emacs make test\n```\n\n## License\n\nThis project is licensed under the GNU General Public License v3.0 -\nsee the LICENSE file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flamberta%2Fgraphael","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flamberta%2Fgraphael","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flamberta%2Fgraphael/lists"}