{"id":24362886,"url":"https://github.com/fabianmurariu/rustgraphblas","last_synced_at":"2025-04-10T10:53:14.794Z","repository":{"id":57665246,"uuid":"230126985","full_name":"fabianmurariu/rustgraphblas","owner":"fabianmurariu","description":"rust-library to wrap GraphBLAS.h","archived":false,"fork":false,"pushed_at":"2023-03-19T15:27:27.000Z","size":81,"stargazers_count":26,"open_issues_count":1,"forks_count":0,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-05-18T05:03:14.691Z","etag":null,"topics":["graph-algorithms","graphblas","rust-library"],"latest_commit_sha":null,"homepage":null,"language":"Rust","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/fabianmurariu.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,"governance":null}},"created_at":"2019-12-25T16:24:44.000Z","updated_at":"2024-03-22T21:30:09.000Z","dependencies_parsed_at":"2023-09-28T07:18:32.799Z","dependency_job_id":null,"html_url":"https://github.com/fabianmurariu/rustgraphblas","commit_stats":{"total_commits":51,"total_committers":1,"mean_commits":51.0,"dds":0.0,"last_synced_commit":"03217194a2f3c0f3d2c9ed3f9be730eb0c7447c8"},"previous_names":["fabianmurariu/libgraphblas"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabianmurariu%2Frustgraphblas","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabianmurariu%2Frustgraphblas/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabianmurariu%2Frustgraphblas/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabianmurariu%2Frustgraphblas/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fabianmurariu","download_url":"https://codeload.github.com/fabianmurariu/rustgraphblas/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248204588,"owners_count":21064866,"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":["graph-algorithms","graphblas","rust-library"],"created_at":"2025-01-18T22:54:12.761Z","updated_at":"2025-04-10T10:53:14.771Z","avatar_url":"https://github.com/fabianmurariu.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rustgraphblas\n\nWrapper for `GraphBLAS.h` exposing a nicer rust API\n\nExposes a set of routines over sparse matrices and sparse vectors combined with\nvarious semirings. This allows graphs to be represented as sparse matrices and\nvarious algorithms (bfs, connected components, page rank, ..) to be implemented\nas a set of linear algebra operations.\n\nMore about GraphBLAS [here](http://graphblas.org/index.php?title=Graph_BLAS_Forum) \n\nRequirements: build and install GraphBLAS dependency, for details see[here](https://github.com/DrTimothyAldenDavis/GraphBLAS/blob/stable/README.md \"GraphBLAS readme\") \n\n```bash\ncd deps/GraphBLAS\nmake clean install\n```\n\nExample of BFS from [bfs5m.c](https://github.com/fabianmurariu/SuiteSparse/blob/master/GraphBLAS/Demo/Source/bfs5m.c#L33)\n```rust\n/**\n * this is the test for the graph on the cover of \n * Graph Algorithms in the Language of Linear Algebra\n * where by multiplying a boolean matrix with \n * a boolean vector on the and/or semiring until there are no successor we get BFS\n * */\nfn graph_blas_port_bfs(){\n    let s:u64 = 0; // start at 0\n    let n = 7; //vertices\n\n    let mut A = SparseMatrix::\u003cbool\u003e::empty((n, n));\n\n    let edges_n:usize = 10;\n    A.load(edges_n as u64, \u0026vec![true; edges_n],\n           \u0026[0, 0, 1, 1, 2, 3, 4, 5, 6, 6],\n           \u0026[1, 3, 6, 4, 5, 2, 5, 2, 2, 3]);\n\n    let mut v = SparseVector::\u003ci32\u003e::empty(n);\n    let mut q = SparseVector::\u003cbool\u003e::empty(n);\n\n    let mut default_desc = Descriptor::default();\n\n    // GrB_assign (v, NULL, NULL, 0, GrB_ALL, n, NULL) ;   // make v dense\n    v.assign_all(empty_mask::\u003cbool\u003e(), None, 0, n, \u0026default_desc);\n\n    //finish pending work on v\n    assert_eq!(n, v.nvals());\n    // GrB_Vector_setElement (q, true, s) ;   // q[s] = true, false elsewhere\n    q.insert(s, true);\n\n    // GrB_Monoid_new (\u0026Lor, GrB_LOR, (bool) false) ;\n    // GrB_Semiring_new (\u0026Boolean, Lor, GrB_LAND) ;\n    // FIXME: Semirings do not OWN monoids\n    let lor_monoid = SparseMonoid::\u003cbool\u003e::new(BinaryOp::\u003cbool, bool, bool\u003e::lor(), false);\n    let lor_monoid2 = SparseMonoid::\u003cbool\u003e::new(BinaryOp::\u003cbool, bool, bool\u003e::lor(), false);\n    let or_and_semi = Semiring::new(lor_monoid, BinaryOp::\u003cbool, bool, bool\u003e::land());\n\n\n    let mut desc = Descriptor::default();\n    desc.set(Field::Mask, Value::SCMP).set(Field::Output, Value::Replace);\n\n    let mut successor = true;\n\n    let mut level:i32 = 1;\n    while successor \u0026\u0026 level \u003c= (n as i32) {\n        v.assign_all(Some(\u0026q), None, level, n, \u0026default_desc);\n\n        q.vxm(Some(\u0026v), None, \u0026A, \u0026or_and_semi, \u0026desc);\n\n        q.reduce(\u0026mut successor, None, \u0026lor_monoid2, \u0026default_desc);\n\n        level = level + 1;\n    }\n    assert_eq!(v.get(0), Some(1));\n\n    assert_eq!(v.get(1), Some(2));\n    assert_eq!(v.get(3), Some(2));\n\n    assert_eq!(v.get(4), Some(3));\n    assert_eq!(v.get(6), Some(3));\n    assert_eq!(v.get(2), Some(3));\n\n    assert_eq!(v.get(5), Some(4));\n\n}\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffabianmurariu%2Frustgraphblas","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffabianmurariu%2Frustgraphblas","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffabianmurariu%2Frustgraphblas/lists"}