{"id":32200435,"url":"https://github.com/mikeasilva/simplegraphdb","last_synced_at":"2025-10-22T03:48:14.563Z","repository":{"id":56935161,"uuid":"336597197","full_name":"mikeasilva/simplegraphdb","owner":"mikeasilva","description":"A Simple Graph Database","archived":false,"fork":false,"pushed_at":"2021-03-12T11:18:44.000Z","size":58,"stargazers_count":8,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-22T03:48:11.993Z","etag":null,"topics":["graph","r","sqlite","sqlite-database"],"latest_commit_sha":null,"homepage":"","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mikeasilva.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":"2021-02-06T17:36:53.000Z","updated_at":"2025-08-16T15:51:40.000Z","dependencies_parsed_at":"2022-08-21T01:10:14.467Z","dependency_job_id":null,"html_url":"https://github.com/mikeasilva/simplegraphdb","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/mikeasilva/simplegraphdb","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikeasilva%2Fsimplegraphdb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikeasilva%2Fsimplegraphdb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikeasilva%2Fsimplegraphdb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikeasilva%2Fsimplegraphdb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mikeasilva","download_url":"https://codeload.github.com/mikeasilva/simplegraphdb/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikeasilva%2Fsimplegraphdb/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280376535,"owners_count":26320276,"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-10-22T02:00:06.515Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","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":["graph","r","sqlite","sqlite-database"],"created_at":"2025-10-22T03:48:10.029Z","updated_at":"2025-10-22T03:48:14.557Z","avatar_url":"https://github.com/mikeasilva.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"# About\n\nThis is a simple graph database in [SQLite](https://www.sqlite.org/index.html), inspired by \"[Denis Papathanasiou's simple-graph project](https://github.com/dpapathanasiou/simple-graph)\", however this is written in R.  This package is fully compatible with the python equivalant and interoperable.  There are minor differences in the API, but it is largely identical.\n\n# Structure\n\nSimilar to the python library, the [schema](https://github.com/mikeasilva/simplegraphdb/blob/main/tests/schema.sql) consists of just two structures:\n\n* Nodes - these are any [json](https://www.json.org/) objects, with the only constraint being that they each contain a unique `id` value \n* Edges - these are pairs of node `id` values, specifying the direction, with an optional json object as connection properties\n\n# Applications\n\n* [Social networks](https://en.wikipedia.org/wiki/Social_graph)\n* [Interest maps/recommendation finders](https://en.wikipedia.org/wiki/Interest_graph)\n* [To-do / task lists](https://en.wikipedia.org/wiki/Task_list)\n* [Bug trackers](https://en.wikipedia.org/wiki/Open-source_software_development#Bug_trackers_and_task_lists)\n* [Customer relationship management (CRM)](https://en.wikipedia.org/wiki/Customer_relationship_management)\n* [Gantt chart](https://en.wikipedia.org/wiki/Gantt_chart)\n\n# Usage\n\n## Installation\n\n  - `devtools::install_github(\"https://github.com/mikeasilva/simplegraphdb\")`\n\n## Basic Functions\n\nThe R package provides convenience functions for [atomic transactions](https://en.wikipedia.org/wiki/Atomicity_(database_systems)) to add, delete, connect, and search for nodes.\n\nAny single node or path of nodes can also be depicted graphically by using the `visualize` function within the database script to generate [dot](https://graphviz.org/doc/info/lang.html) files, which in turn can be converted to images with Graphviz.\n\n### Example\n\nOnce loading the package in R, we can create, [upsert](https://en.wiktionary.org/wiki/upsert), and connect people from the early days of [Apple Computer](https://en.wikipedia.org/wiki/Apple_Inc.). The resulting database will be saved to a SQLite file named `apple.sqlite`:\n\n```\napple \u003c- \"apple.sqlite\"\ninitialize(apple)\natomic(apple, add_node(list(\"name\" = \"Apple Computer Company\", \"type\" = c(\"company\", \"start-up\"), \"founded\" = \"April 1, 1976\"), 1))\natomic(apple, add_node(list(\"name\" = \"Steve Wozniak\", \"type\" = c(\"person\", \"engineer\", \"founder\")), 2))\natomic(apple, add_node(list(\"name\" = \"Steve Jobs\", \"type\" = c(\"person\", \"designer\", \"founder\")), 3))\natomic(apple, add_node(list(\"name\" = \"Ronald Wayne\", \"type\" = c(\"person\", \"administrator\", \"founder\")), 4))\natomic(apple, add_node(list(\"name\" = \"Mike Markkula\", \"type\" = c(\"person\", \"investor\")), 5))\natomic(apple, connect_nodes(2, 1, list(\"action\" = \"founded\")))\natomic(apple, connect_nodes(3, 1, list(\"action\" = \"founded\")))\natomic(apple, connect_nodes(4, 1, list(\"action\" = \"founded\")))\natomic(apple, connect_nodes(5, 1, list(\"action\" = \"invested\", \"equity\" = 80000, \"debt\" = 170000)))\natomic(apple, connect_nodes(1, 4, list(\"action\" = \"divested\", \"amount\" = 800, \"date\" = \"April 12, 1976\")))\natomic(apple, connect_nodes(2, 3))\natomic(apple, upsert_node(2, list(\"nickname\" = \"Woz\"), apple))\n```\n\nThe nodes can be searched by their ids or any other combination of attributes (either as strict equality, or using `search_like` in combination with `search_starts_with` or `search_contains`):\n\n```\natomic(apple, find_node(1))\n{'name': 'Apple Computer Company', 'type': ['company', 'start-up'], 'founded': 'April 1, 1976', 'id': 1}\natomic(apple, find_nodes({'name': 'Steve'}, \"search_like\", \"search_starts_with\"))\n[{'name': 'Steve Wozniak', 'type': ['person', 'engineer', 'founder'], 'id': 2, 'nickname': 'Woz'}, {'name': 'Steve Jobs', 'type': ['person', 'designer', 'founder'], 'id': 3}]\n```\n\nPaths through the graph can be discovered with a starting node id, and an optional ending id; the default neighbor expansion is nodes connected nodes in either direction, but that can changed by specifying either `find_outbound_neighbors` or `find_inbound_neighbors` instead:\n\n```\ntraverse(apple, 2, 3)\n[2, 3]\ntraverse(apple, 4, 5)\n[4, 1, 5]\ntraverse(apple, 5, neighbors_fn=\"find_inbound_neighbors\")\n[5]\ntraverse(apple, 5, neighbors_fn=\"find_outbound_neighbors\")\n[5, 1, 4]\ntraverse(apple, 5, neighbors_fn=\"find_neighbors\")\n[5, 1, 4, 3, 2]\n```\n\nAny path or list of nodes can rendered graphically by using the `visualize` function. This command produces [dot](https://graphviz.org/doc/info/lang.html) files, which are also rendered as images with Graphviz:\n\n```\nvisualize(apple, 'apple.dot', c(4, 1, 5))\n```\n\nThere are display options to help refine what is produced:\n\n```\nvisualize(apple, 'apple.dot', c(4, 1, 5), exclude_node_keys=c('type'), hide_edge_key=TRUE)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmikeasilva%2Fsimplegraphdb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmikeasilva%2Fsimplegraphdb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmikeasilva%2Fsimplegraphdb/lists"}