kleene-gar
X.gar graphs as DataFusion tables, read in place. An X.gar directory is a graphar integer graph (its mapped layout): one Arrow IPC file per vertex column and per edge order, mapped from disk. GarGraph opens one; each vertex type and each edge type is a GarTable, a DataFusion TableProvider whose columns are the mapped Arrow arrays themselves. GarGraph::adjacency hands an edge type's offsets and neighbours, both orders, as buffers that share the mapping. GarGraph::id_space numbers the set's vertex types one after the other (IdSpace), in the order the set's <name>.graph.yml lists them, so nodes of two types never share a number and a node's id is the same for every reader.
Part of kleene.
use graphar::mapped::{IntColumn, IntEdges, IntGraphWriter};
use kleene_gar::{EdgeType, GarGraph};
// Write a small set: three functions, two calls (graphar's integer graph writer).
let dir = std::env::temp_dir().join(format!("kleene-gar-readme-{}", std::process::id()));
let _ = std::fs::remove_dir_all(&dir);
std::fs::create_dir_all(&dir)?;
let mut w = IntGraphWriter::new(&dir, "X")?;
w.vertices("fn", 3, vec![("size".into(), IntColumn::U32(vec![10, 20, 30]))])?;
w.edges(IntEdges::from_pairs(("fn", "call", "fn"), (3, 3), &[0, 1], &[1, 2], vec![])?)?;
w.finish()?;
// Read it in place.
let g = GarGraph::open(&dir)?;
assert_eq!(g.vertex_count("fn")?, 3);
let calls = g.table("fn_call_fn")?.expect("the edge table");
assert_eq!(calls.batch(None)?.num_rows(), 2);
let adj = g.adjacency(&EdgeType::new("fn", "call", "fn"))?;
# let _ = adj;
std::fs::remove_dir_all(&dir)?;
# Ok::<(), Box<dyn std::error::Error>>(())
Licence
MIT or Apache-2.0, at your option.