{"id":22472196,"url":"https://github.com/ckampfe/strand","last_synced_at":"2025-08-02T09:32:35.384Z","repository":{"id":57553602,"uuid":"91212828","full_name":"ckampfe/strand","owner":"ckampfe","description":"Graphs, like Loom","archived":false,"fork":false,"pushed_at":"2022-02-16T20:49:42.000Z","size":37,"stargazers_count":10,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-30T16:56:29.806Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Elixir","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/ckampfe.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":"2017-05-14T01:36:33.000Z","updated_at":"2022-12-07T21:47:44.000Z","dependencies_parsed_at":"2022-08-28T11:40:25.580Z","dependency_job_id":null,"html_url":"https://github.com/ckampfe/strand","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ckampfe%2Fstrand","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ckampfe%2Fstrand/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ckampfe%2Fstrand/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ckampfe%2Fstrand/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ckampfe","download_url":"https://codeload.github.com/ckampfe/strand/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228461244,"owners_count":17923761,"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":[],"created_at":"2024-12-06T12:12:29.381Z","updated_at":"2024-12-06T12:12:32.206Z","avatar_url":"https://github.com/ckampfe.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Strand\n\nA library for graphs. This library is mostly an Elixir port of the amazing [Loom](https://github.com/aysylu/loom) library for Clojure.\n\n[![Elixir CI](https://github.com/ckampfe/strand/actions/workflows/elixir.yml/badge.svg)](https://github.com/ckampfe/strand/actions/workflows/elixir.yml)\n\n[Documentation](https://hexdocs.pm/strand/)\n\n## Installation\n\nThis library is [available in Hex](https://hex.pm/packages/strand).\nTo install, add `strand` to your list of dependencies in `mix.exs`:\n\n```elixir\ndef deps do\n  [{:strand, \"~\u003e 0.6\"}]\nend\n```\n\n## Use\n\n```elixir\niex(1)\u003e require MapSet, as: Set\niex(2)\u003e require Strand.Protocol.Graph, as: G\niex(3)\u003e require Strand.Protocol.Digraph, as: DG\niex(4)\u003e require Strand.Impl.Digraph, as: Digraph\niex(5)\u003e require Strand.Alg, as: Alg\niex(6)\u003e x = %{a: Set.new([]),\n              b: Set.new([:a]),\n              c: Set.new([:b]),\n              d: Set.new([:b, :e]),\n              e: Set.new([:a]),\n              f: Set.new([:d, :e])}\niex(7)\u003e G.nodes(x)\n#MapSet\u003c[:a, :b, :c, :d, :e, :f]\u003e\niex(8)\u003e G.edges(x)\n#MapSet\u003c[b: :a, c: :b, d: :b, d: :e, e: :a, f: :d, f: :e]\u003e\niex(9)\u003e G.out_degree(x, :d)\n# 2\niex(10)\u003e G.has_edge?(x, {:f, :e})\n# true\niex(11)\u003e G.out_edges(x, :f)\n#MapSet\u003c[f: :d, f: :e]\u003e\niex(12)\u003e G.successors(x, :f)\n#MapSet\u003c[:d, :e]\u003e\niex(13)\u003e G.has_node?(x, :e)\n# true\niex(14)\u003e Alg.sort_topo(x)\n[:a, :b, :c, :e, :d, :f]\niex(15)\u003e DG.predecessors(x, :b)\n#MapSet\u003c[:c, :d]\u003e\niex(16)\u003e DG.transpose(x)\n# %{a: #MapSet\u003c[:b, :e]\u003e, b: #MapSet\u003c[:c, :d]\u003e, d: #MapSet\u003c[:f]\u003e,\n#   e: #MapSet\u003c[:d, :f]\u003e}\niex(17)\u003e DG.in_edges(x, :b)\n#MapSet\u003c[c: :b, d: :b]\u003e\niex(18)\u003e DG.in_degree(x, :b)\n# 2\niex(19)\u003e dg = Digraph.new(x)\n# %Strand.Digraph{adj: %{b: #MapSet\u003c[:a]\u003e,\n#                        c: #MapSet\u003c[:b]\u003e,\n#                        d: #MapSet\u003c[:b, :e]\u003e,\n#                        e: #MapSet\u003c[:a]\u003e,\n#                        f: #MapSet\u003c[:d, :e]\u003e},\n#                 in: %{a: #MapSet\u003c[:b, :e]\u003e,\n#                       b: #MapSet\u003c[:c, :d]\u003e,\n#                       d: #MapSet\u003c[:f]\u003e,\n#                       e: #MapSet\u003c[:d, :f]\u003e},\n#                 nodeset: #MapSet\u003c[:a, :b, :c, :d, :e, :f]\u003e}\niex(20)\u003e dg |\u003e DG.transpose\n# %Strand.Digraph{adj: %{a: #MapSet\u003c[:b, :e]\u003e,\n#                        b: #MapSet\u003c[:c, :d]\u003e,\n#                        d: #MapSet\u003c[:f]\u003e,\n#                        e: #MapSet\u003c[:d, :f]\u003e},\n#                 in: %{b: #MapSet\u003c[:a]\u003e,\n#                       c: #MapSet\u003c[:b]\u003e,\n#                       d: #MapSet\u003c[:b, :e]\u003e,\n#                       e: #MapSet\u003c[:a]\u003e,\n#                       f: #MapSet\u003c[:d, :e]\u003e},\n#                 nodeset: #MapSet\u003c[:a, :b, :c, :d, :e, :f]\u003e}\niex(21)\u003e dg |\u003e DG.in_degree(:b)\n# 2\niex(22)\u003e dg |\u003e DG.in_edges(:b)\n#MapSet\u003c[c: :b, d: :b]\u003e\niex(23)\u003e dg |\u003e DG.predecessors(:b)\n#MapSet\u003c[:c, :d]\u003e\n```\n\n## License\n\nCopyright (C) 2017 Clark Kampfe\n\nDistributed under the Eclipse Public License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fckampfe%2Fstrand","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fckampfe%2Fstrand","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fckampfe%2Fstrand/lists"}