{"id":24907903,"url":"https://github.com/knowald/simple_graph","last_synced_at":"2025-07-25T23:04:21.662Z","repository":{"id":62558778,"uuid":"111831137","full_name":"knowald/simple_graph","owner":"knowald","description":"A simple graph library for Ruby.","archived":false,"fork":false,"pushed_at":"2017-12-06T15:31:55.000Z","size":96,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-12T12:11:44.140Z","etag":null,"topics":["bfs","datastructures","graphs","pathfinding","ruby"],"latest_commit_sha":null,"homepage":null,"language":"Ruby","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/knowald.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-11-23T16:33:17.000Z","updated_at":"2024-05-28T06:17:24.000Z","dependencies_parsed_at":"2022-11-03T10:00:23.134Z","dependency_job_id":null,"html_url":"https://github.com/knowald/simple_graph","commit_stats":null,"previous_names":["knowald/simple_graph","vesther/simple_graph"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/knowald/simple_graph","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/knowald%2Fsimple_graph","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/knowald%2Fsimple_graph/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/knowald%2Fsimple_graph/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/knowald%2Fsimple_graph/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/knowald","download_url":"https://codeload.github.com/knowald/simple_graph/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/knowald%2Fsimple_graph/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265066119,"owners_count":23706062,"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":["bfs","datastructures","graphs","pathfinding","ruby"],"created_at":"2025-02-02T01:30:40.686Z","updated_at":"2025-07-25T23:04:21.605Z","avatar_url":"https://github.com/knowald.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SimpleGraph\n\nA very basic graph gem for Ruby.\n\nCurrently only unweighted, undirected graphs are supported.\nThis means that multiple edges between nodes are ignored, although self loops are allowed.\n\n#### Warning\nNote that this is a very early version, and everything about this library is subject to change at any given time without notice. Expect breaking changes.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'simple_graph'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install simple_graph\n\n## Documentation\n\nDocs are built using YARD and are available at https://vesther.github.io/simple_graph/\n\n## Usage\n\n### Quickstart\n```ruby\nrequire \"simple_graph\"\n\n# Creating a new, empty graph\ngraph = SimpleGraph::Graph.new\n\n# Adding nodes to the graph\n# Creates a empty node containing only a autogenerated identifier\n# Returns a graph-unique identifier for the newly created node\nfoo = graph.add_node()\n# IDs can also be set manually\ngraph.add_node(id: \"Kevin\")\n# Graphs can also hold arbitrary information in the 'data' hash\nstuff = {\n  age: 21,\n  depression: true\n}\nbar = graph.add_node(id: \"Igor\", data: stuff)\n\n# Edges can be created by passing the two node IDs to the connect_nodes method\ngraph.connect_nodes(foo, \"Kevin\")\n\n# Paths between two nodes can be found by breadth-first search\npaths = graph.find_paths(foo, bar)\n\n# Retrieving info about the graph\ngraph.nodes # Lists all of the nodes in the graph\ngraph.node_count # Returns the amount of nodes in the graph\ngraph.node_ids # Array of node identifiers in the graph\ngraph.are_connected?(foo, bar) # Checks whether two nodes are connected by an Edge\ngraph.include?(\"Kevin\") # Checks whether the graph includes a node with the given ID\n\n# Graphs can be written to files in the DOT format to be used with Graphviz\n# Note that the node ID will be used for labels\nFile.write(\"test.dot\", graph.to_dot_string)\n\n# Export a graph to a JSON file\nFile.write(\"output.json\", graph.to_json)\n\n# Import a graph from a JSON file\ngraph.load_from_json(File.read(\"input.json\"))\n```\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/vesther/simple_graph.\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fknowald%2Fsimple_graph","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fknowald%2Fsimple_graph","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fknowald%2Fsimple_graph/lists"}