{"id":20401441,"url":"https://github.com/jackrusher/arrowic","last_synced_at":"2025-04-12T14:09:09.191Z","repository":{"id":57713157,"uuid":"82911735","full_name":"jackrusher/arrowic","owner":"jackrusher","description":"Quick and dirty directed graph viewer for REPL explorations.","archived":false,"fork":false,"pushed_at":"2023-12-22T09:29:52.000Z","size":31,"stargazers_count":24,"open_issues_count":0,"forks_count":4,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-10T13:18:32.962Z","etag":null,"topics":["clojure","graph"],"latest_commit_sha":null,"homepage":null,"language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"epl-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jackrusher.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2017-02-23T09:43:54.000Z","updated_at":"2023-11-01T16:41:47.000Z","dependencies_parsed_at":"2022-09-05T22:50:17.788Z","dependency_job_id":null,"html_url":"https://github.com/jackrusher/arrowic","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/jackrusher%2Farrowic","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jackrusher%2Farrowic/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jackrusher%2Farrowic/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jackrusher%2Farrowic/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jackrusher","download_url":"https://codeload.github.com/jackrusher/arrowic/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248578870,"owners_count":21127713,"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":["clojure","graph"],"created_at":"2024-11-15T04:49:26.932Z","updated_at":"2025-04-12T14:09:09.171Z","avatar_url":"https://github.com/jackrusher.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 'Arrowic\n\nO frabjous day! Callooh! Callay! Yet another tiny, incomplete clojure\nwrapper around a Java library!\n\nIn this case, the simplest\n[directed graph](https://en.wikipedia.org/wiki/Directed_graph) viewer\npossible for those situation where you are in the process of\ninterrogating some data and would like to how it looks as boxes and\narrows.\n\nI love `graphviz` as much as the next former-AT\u0026T Research employee,\nbut it's also rather nice to be able to generate an *interactive*\ngraph layout from _within_ `emacs` (or whatever your REPL of choice),\ntinker with it by hand, then export it to SVG.\n\nThe default graph style looks like [this](example.svg). There is also\na rather large collection of styling options that are currently\nundocumented. See the `arrowic.style` namespace to get some idea of\nhow to use styles.\n\nIf you’re building a Swing application (hopefully\nusing [seesaw](https://github.com/daveray/seesaw)), you can create a\nSwing component to display your graph using the `as-swing-component`\nfunction.\n\n## Usage\n\nI'm not currently pushing new versions of this library to Clojars, so\nyou should use it as a git dependency from `deps.edn`. Once you have\nit in your project, require whichever parts of the public API you need:\n\n``` clojure\n(ns fancy-project\n  (:require [arrowic.core :refer [create-graph graph-from-seqs insert-edge! insert-vertex! create-viewer]]))\n```\n\nThe easiest way to get a quick graph from your data is probably\n`graph-from-seqs`, to which you can pass a sequence of sequences of 2\nor 3 items where the first two are nodes and the (optional) third is\nan edge label. The return value of that function can be passed to\n`create-viewer`, which will pop up a new window showing the graph:\n\n``` clojure\n(def viewer\n  (create-viewer\n   (graph-from-seqs [[\"Clojure\" \"Lisp\" \"is-a\"]\n                     [\"Clojure\" \"functional programming\" \"supports-paradigm\"]])))\n```\n\nIf you would rather use the imperative API, a new empty graph can be\ncreated using `create-graph`. The graph thus created can then be\nmutated in place inside of a `with-graph` form using `insert-vertex!`\nand `insert-edge!`.\n\n``` clojure\n(use '[arrowic.core])\n\n;; grab some words from the UNIX dictionary\n(def words\n  (into [] (clojure.string/split-lines (slurp \"/usr/share/dict/words\"))))\n\n;; make a random graph full of words\n(defn random-graph []\n  (with-graph (create-graph)\n    (let [vertices (repeatedly 10 #(insert-vertex! (rand-nth words)))]\n      (doseq [edge-label (repeatedly 20 #(rand-nth words))]\n        (insert-edge! (rand-nth vertices) \n                      (rand-nth vertices)\n                      :label edge-label)))))\n\n(def graph (random-graph))\n\n(def viewer (create-viewer graph))\n\n;; you can re-use a viewer with a new graph like this:\n(def another-graph (random-graph))\n\n(view viewer another-graph)\n```\n\nIt's also easy to export a graph as an SVG diagram:\n\n``` clojure\n(spit \"example.svg\" (as-svg another-graph))\n```\n\n## License\n\nCopyright © 2018-2023 Jack Rusher\n\nDistributed under the Eclipse Public License either version 1.0 or (at\nyour option) any later version.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjackrusher%2Farrowic","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjackrusher%2Farrowic","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjackrusher%2Farrowic/lists"}