{"id":15295155,"url":"https://github.com/objectionary/sodg","last_synced_at":"2025-04-11T07:45:30.475Z","repository":{"id":60755987,"uuid":"543969974","full_name":"objectionary/sodg","owner":"objectionary","description":"Rust implementation of Surging Object DiGraph (SODG)","archived":false,"fork":false,"pushed_at":"2025-04-04T14:15:38.000Z","size":749,"stargazers_count":11,"open_issues_count":22,"forks_count":5,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-04T15:26:09.984Z","etag":null,"topics":["eolang","oop","rust","rust-crate","rust-lang","rust-library"],"latest_commit_sha":null,"homepage":"https://crates.io/crates/sodg","language":"Rust","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/objectionary.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-10-01T09:37:47.000Z","updated_at":"2025-03-10T13:33:59.000Z","dependencies_parsed_at":"2023-02-17T16:00:34.778Z","dependency_job_id":"53510719-2954-43f9-89e0-3e9fa5dccced","html_url":"https://github.com/objectionary/sodg","commit_stats":{"total_commits":409,"total_committers":5,"mean_commits":81.8,"dds":0.2396088019559902,"last_synced_commit":"93eee7bacac4c978393a60bb643c5bd2a482f59c"},"previous_names":["objectionary/sot"],"tags_count":32,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/objectionary%2Fsodg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/objectionary%2Fsodg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/objectionary%2Fsodg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/objectionary%2Fsodg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/objectionary","download_url":"https://codeload.github.com/objectionary/sodg/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248359357,"owners_count":21090514,"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":["eolang","oop","rust","rust-crate","rust-lang","rust-library"],"created_at":"2024-09-30T17:08:49.843Z","updated_at":"2025-04-11T07:45:30.457Z","avatar_url":"https://github.com/objectionary.png","language":"Rust","readme":"# Surging Object Di-Graph, in Rust\n\n[![EO principles respected here](https://www.elegantobjects.org/badge.svg)](https://www.elegantobjects.org)\n[![We recommend IntelliJ IDEA](https://www.elegantobjects.org/intellij-idea.svg)](https://www.jetbrains.com/idea/)\n\n[![cargo](https://github.com/objectionary/sodg/actions/workflows/cargo.yml/badge.svg)](https://github.com/objectionary/sodg/actions/workflows/cargo.yml)\n[![crates.io](https://img.shields.io/crates/v/sodg.svg)](https://crates.io/crates/sodg)\n[![PDD status](https://www.0pdd.com/svg?name=objectionary/sodg)](https://www.0pdd.com/p?name=objectionary/sodg)\n[![codecov](https://codecov.io/gh/objectionary/sodg/branch/master/graph/badge.svg)](https://codecov.io/gh/objectionary/sodg)\n[![Hits-of-Code](https://hitsofcode.com/github/objectionary/sodg)](https://hitsofcode.com/view/github/objectionary/sodg)\n[![License](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/objectionary/sodg/blob/master/LICENSE.txt)\n[![docs.rs](https://img.shields.io/docsrs/sodg)](https://docs.rs/sodg/latest/sodg/)\n\nThis Rust library implements a Surging Object DiGraph (SODG) for\n[reo](https://github.com/objectionary/reo) virtual machine for\n[EO](https://www.eolang.org) programs. The graph is \"surging\" because\nit automatically behind the scene deletes vertices and edges from itself,\nwhich is also known as \"garbage collection\" mechanism. A vertex gets deleted\nright after the data it contains is read _and_ no other vertices\ntransitively point to it.\n\nHere is how you can create a di-graph:\n\n```rust\nuse sodg::Sodg;\nuse sodg::Hex;\nlet mut g = Sodg::empty(256);\ng.add(0); // add a vertex no.0\ng.add(1); // add a vertex no.1\ng.bind(0, 1, \"foo\"); // connect v0 to v1 with label \"foo\"\ng.put(1, \u0026Hex::from_str_bytes(\"Hello, world!\")); // attach data to v1\n```\n\nThen, you can find a vertex by the label of an edge departing\nfrom another vertex:\n\n```rust\nlet id = g.kid(0, \"foo\");\nassert_eq!(1, id);\n```\n\nThen, you can find all kids of a vertex:\n\n```rust\nlet kids: Vec\u003c(String, String, usize)\u003e = g.kids(0);\nassert_eq!(\"foo\", kids[0].0);\nassert_eq!(\"bar\", kids[0].1);\nassert_eq!(1, kids[0].2);\n```\n\nThen, you can read the data of a vertex:\n\n```rust\nlet hex: Hex = g.data(1);\nlet num: i64 = hex.to_i64()?;\nassert_eq!(42, num);\n```\n\nThen, you can print the graph:\n\n```rust\nprintln!(\"{:?}\", g);\n```\n\nUsing `merge()`, you can merge two graphs together, provided they are trees.\n\nUsing `save()` and `load()`, you can serialize and deserialize the graph.\n\nUsing `to_xml()` and `to_dot()`, you can print it to\n[XML](https://en.wikipedia.org/wiki/XML) and\n[DOT](https://graphviz.org/doc/info/lang.html).\n\nUsing `slice()` and `slice_some()`, you can take a part/slice\nof the graph (mostly for debugging purposes).\n\nRead [the documentation](https://docs.rs/sodg/latest/sodg/).\n\n## How to Contribute\n\nFirst, install [Rust](https://www.rust-lang.org/tools/install) and then:\n\n```bash\ncargo test -vv\n```\n\nIf everything goes well, fork repository, make changes, send us a\n[pull request](https://www.yegor256.com/2014/04/15/github-guidelines.html).\nWe will review your changes and apply them to the `master` branch shortly,\nprovided they don't violate our quality standards. To avoid frustration,\nbefore sending us your pull request please run `cargo test` again. Also,\nrun `cargo fmt` and `cargo clippy`.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fobjectionary%2Fsodg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fobjectionary%2Fsodg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fobjectionary%2Fsodg/lists"}