Onager
A DuckDB extension for graph data analytics
Install / Use
/learn @CogitatorTech/OnagerREADME
A Graph Analytics Toolbox for DuckDB
</div>Onager is a DuckDB extension that adds a large number of graph analytics functions to DuckDB, including centrality measures, community detection algorithms, pathfinding algorithms, graph metrics, and graph generators. Onager is written in Rust and uses Graphina graph library under the hood.
Compared to DuckPGQ, Onager is focused on graph analytics instead of graph querying. More specifically, DuckPGQ tries to implement SQL/PGQ (the SQL:2023 standard) for graph pattern matching and path-finding queries with a property graph model. Onager instead provides a collection of ready-to-use graph algorithms (like PageRank, Louvain community detection, Dijkstra's shortest path, etc.) as simple table functions. Users typically want something like DuckPGQ when they need to query graph patterns or model the data in a property graph model (like a graph database), and use Onager when they need to run specific graph algorithms on their graph data for a specific application.
Features
- Adds over 40 graph algorithms as SQL table functions
- Provides a simple and uniform API
- Supports both directed and undirected graphs
- Supports weighted and unweighted edges
- Includes multi-threaded algorithm implementations
See ROADMAP.md for the list of implemented and planned features. Check out KNOWN_ISSUES.md for known issues and limitations of the current version.
[!IMPORTANT] Onager is in early development, so bugs and breaking changes are expected. Please use the issues page to report bugs or request features.
Quickstart
Install from Community Extensions Repository
You can install and load Onager from the DuckDB community extensions repository by running the following SQL commands in the DuckDB shell:
install onager from community;
load onager;
Build from Source
Alternatively, you can build Onager from source and use it by following these steps:
- Clone the repository and build the Onager extension from source:
git clone --recursive https://github.com/CogitatorTech/onager.git
cd onager
# This might take a while to run
make release
- Start DuckDB shell (with Onager statically linked to it):
./build/release/duckdb
[!NOTE] After building from source, the Onager binary will be
build/release/extension/onager/onager.duckdb_extension. You can load it using theload 'build/release/extension/onager/onager.duckdb_extension';in the DuckDB shell. Note that the extension binary will only work with the DuckDB version that it was built against. You can download the pre-built binaries from the releases page for your platform.
Trying Onager
-- Create an edge table
create table edges as
select * from
(values (1::bigint, 2::bigint),
(2, 3),
(3, 1),
(3, 4)) t(src, dst);
-- Compute PageRank
select * from onager_ctr_pagerank((select src, dst from edges));
-- Detect communities
select * from onager_cmm_louvain((select src, dst from edges));
-- Find shortest paths
select * from onager_pth_dijkstra((select src, dst from edges), source := 1);
-- Generate a random graph
select * from onager_gen_erdos_renyi(100, 0.1, seed := 42);
Documentation
Check out the Onager documentation for the API documentation and examples.
Contributing
See CONTRIBUTING.md for details on how to make a contribution.
License
Onager is available under either of the following licenses:
- MIT License (LICENSE-MIT)
- Apache License, Version 2.0 (LICENSE-APACHE)
Acknowledgements
Related Skills
himalaya
345.4kCLI to manage emails via IMAP/SMTP. Use `himalaya` to list, read, write, reply, forward, search, and organize emails from the terminal. Supports multiple accounts and message composition with MML (MIME Meta Language).
coding-agent
345.4kDelegate coding tasks to Codex, Claude Code, or Pi agents via background process
tavily
345.4kTavily web search, content extraction, and research tools.
feishu-drive
345.4k|
