{"id":16742277,"url":"https://github.com/clemsos/graph-events","last_synced_at":"2025-04-05T06:26:17.353Z","repository":{"id":57253188,"uuid":"98420629","full_name":"clemsos/graph-events","owner":"clemsos","description":"Manipulate and store states of your graphs over time.","archived":false,"fork":false,"pushed_at":"2017-07-27T07:57:16.000Z","size":1048,"stargazers_count":1,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-18T09:48:02.535Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://clemsos.github.io/graph-events/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/clemsos.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-07-26T12:32:18.000Z","updated_at":"2020-02-28T13:14:07.000Z","dependencies_parsed_at":"2022-08-31T22:11:24.114Z","dependency_job_id":null,"html_url":"https://github.com/clemsos/graph-events","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clemsos%2Fgraph-events","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clemsos%2Fgraph-events/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clemsos%2Fgraph-events/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clemsos%2Fgraph-events/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/clemsos","download_url":"https://codeload.github.com/clemsos/graph-events/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247297537,"owners_count":20915871,"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-10-13T01:23:14.607Z","updated_at":"2025-04-05T06:26:17.331Z","avatar_url":"https://github.com/clemsos.png","language":"JavaScript","readme":"# Graph Events\n\n[![Build Status](https://travis-ci.org/clemsos/graph-events.svg?branch=master)](https://travis-ci.org/clemsos/graph-events)\n\n[![NPM](https://nodei.co/npm/graph-events.png?compact=true)](https://npmjs.org/package/graph-events)\n\n**Graph Events** is a storage system to create and manipulate states of networks and graphs based on the evolution of their properties over time.\n\n\n## How it Works\n\n* Graph are stored using **events**, so you can easily maintain states and do / undo / moderate changes.\n* Everything is serializable in **JSON**, so all data can be stored in databases, plain files or just plain arrays.\n\nSee a [live demo](http://clemsos.github.io/graph-events/).\n\n```js\n// example without browser\n// use `node graph-events-demo.js` to test\n\nconst {GraphEvent, Graph} = require('../lib/index.js')\n\nconst nodes = [\n  { id : 1, label : \"Node A\", type : \"node\" },\n  { id : 2, label : \"Node B\", type : \"node\" },\n  { id : 3, label : \"Node C\", type : \"node\" }\n]\n\nconst edges = [\n  { source : 1, target : 2, label : \"Edge A -\u003e B\", type : \"edge\" },\n  { source : 2, target : 3, label : \"Edge B -\u003e C\", type : \"edge\" }\n]\n\n// create nodes and edges\nconst eventCreateNodes = new GraphEvent({\n  action : \"create\",\n  data : nodes\n})\nconst eventCreateEdges = new GraphEvent({\n  action : \"create\",\n  data : edges\n})\n\n// make some changes\nconst eventDeleteNodeA = new GraphEvent({\n  action : \"delete\",\n  selector : { id : 1, type : \"node\" }\n})\n\nconst graphInit = new Graph([eventCreateNodes, eventCreateEdges ])\nconsole.log( graphInit.nodes().length + \" nodes\" )\n\nconst graphFinal = new Graph([eventCreateNodes, eventCreateEdges, eventUpdateNodeA])\nconsole.log( graphFinal.nodes().length + \" nodes\" )\n\n/*\n* Results in the console :\n*\n* $ node graph-events-demo.js       \n*   3 nodes\n*   2 nodes\n*\n*/\n```\n\nCheck the [examples folder](./examples) to see how it is used.\n\n\n### Commands\n\n| Command | Description | Options |\n|------|------|------|\n| `create` | create new node(s) | Object data |\n| `update` | update elements with new properties | Object selector, Object data |\n| `delete` | delete nodes | Object selector |\n\n### Publish\n\n    npm run prepublish\n    npm publish\n\n### Test\n\n    gulp test\n\n### Docs\n\n    gulp doc\n\nthen navigate to the `/docs` folder to see the documentation.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclemsos%2Fgraph-events","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fclemsos%2Fgraph-events","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclemsos%2Fgraph-events/lists"}