Skip to content

Commit ebdcd91

Browse files
committed
Fix a few bugs
1 parent 8c5eec5 commit ebdcd91

40 files changed

+533
-203
lines changed

Makefile

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -144,14 +144,6 @@ clean-all: clean rust-clean ## Clean everything
144144
check: rust-lint rust-test ## Run all checks (linting and tests)
145145
@echo "All checks passed!"
146146

147-
.PHONY: examples
148-
examples: ## Run SQL examples for Onager extension
149-
@echo "Running the examples in the ${EXAMPLES_DIR} directory..."
150-
@for sql_file in $(EXAMPLES_DIR)/*.sql; do \
151-
echo "Running example: $$sql_file"; \
152-
./build/release/duckdb < $$sql_file; \
153-
echo "============================================================================"; \
154-
done
155147

156148
.PHONY: docs
157149
docs: ## Generate Onager MkDocs documentation

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ and graph generators.
2323
Onager is written in Rust and uses [Graphina](https://github.com/habedi/graphina) graph library under the hood.
2424

2525
Compared to [DuckPGQ](https://github.com/cwida/duckpgq-extension), Onager is focused on graph analytics instead of graph querying.
26-
More specifically, DuckPGQ tries to implement SQL/PGQ (the SQL:2023 standard)
26+
More specifically, DuckPGQ tries to implement [SQL/PGQ](https://pgql-lang.org/) (the SQL:2023 standard)
2727
for graph pattern matching and path-finding queries with a property graph model.
2828
Onager instead provides a collection of ready-to-use graph algorithms (like PageRank, Louvain community detection, Dijkstra's shortest path, etc.)
2929
as simple table functions.
@@ -32,7 +32,7 @@ Users typically want something like DuckPGQ when they need to query graph patter
3232

3333
### Features
3434

35-
- Adds over 30 graph algorithms as SQL table functions
35+
- Adds over 40 graph algorithms as SQL table functions
3636
- Provides a simple and uniform API
3737
- Supports both directed and undirected graphs
3838
- Supports weighted and unweighted edges

ROADMAP.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ It outlines features to be implemented and their current status.
1010

1111
* [x] PageRank centrality
1212
* [x] Personalized PageRank
13-
* [x] Degree centrality (in/out)
13+
* [x] Degree centrality (in and out)
1414
* [x] Betweenness centrality
1515
* [x] Closeness centrality
1616
* [x] Harmonic centrality
@@ -87,7 +87,7 @@ It outlines features to be implemented and their current status.
8787
### 9. Minimum Spanning Tree
8888

8989
* [x] Kruskal's algorithm
90-
* [x] Prim's algorithm
90+
* [ ] Prim's algorithm
9191

9292
### 10. Link Prediction
9393

docs/examples/analytics.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Use PageRank and degree centrality to identify influential users:
1414
```sql
1515
-- Create social network edges
1616
create table follows as select * from (values
17-
(1, 2), (1, 3), (2, 3), (3, 4), (4, 5), (5, 1), (2, 4), (3, 5)
17+
(1::bigint, 2::bigint), (1, 3), (2, 3), (3, 4), (4, 5), (5, 1), (2, 4), (3, 5)
1818
) t(follower, followed);
1919

2020
-- Find top influencers by PageRank
@@ -61,8 +61,8 @@ High local clustering may indicate coordinated behavior:
6161

6262
```sql
6363
create table transactions as select * from (values
64-
(100, 200), (200, 300), (300, 100), -- Triangle (suspicious)
65-
(400, 500), (500, 600) -- Normal chain
64+
(100::bigint, 200::bigint), (200, 300), (300, 100), -- Triangle (suspicious)
65+
(400, 500), (500, 600) -- Normal chain
6666
) t(sender, receiver);
6767

6868
-- Find nodes with high clustering (potential fraud rings)
@@ -85,7 +85,7 @@ where triangles > 0;
8585
```sql
8686
-- User interaction graph
8787
create table interactions as select * from (values
88-
(1, 10), (1, 20), (2, 10), (2, 30), (3, 20), (3, 30)
88+
(1::bigint, 10::bigint), (1, 20), (2, 10), (2, 30), (3, 20), (3, 30)
8989
) t(user_id, item_id);
9090

9191
-- Create edges (user-item bipartite graph)
@@ -95,7 +95,7 @@ create table edges as
9595
-- Recommend items for user 1 based on their interactions
9696
-- Using ego graph to explore local neighborhood
9797
select *
98-
from onager_sub_k_hop_neighbors(edges, start := 1, k := 2)
98+
from onager_sub_k_hop((select src, dst from edges), start := 1::bigint, k := 2)
9999
where node_id > 1000; -- Filter to items only
100100
```
101101

docs/examples/basic.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
# Basic Usage
1+
---
2+
title: Basic Usage
3+
description: Basic graph analytics workflows using Onager.
4+
---
25

3-
This example shows basic graph analytics workflows using the Onager.
6+
# Basic Usage
47

58
## Setup
69

docs/examples/centrality.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
---
2+
title: Centrality Analysis Example
3+
description: Finding influential nodes in a network.
4+
---
5+
16
# Centrality Analysis Example
27

38
## Finding Influential Nodes in a Network

docs/examples/community.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
---
2+
title: Community Detection Example
3+
description: Segmenting users into groups.
4+
---
5+
16
# Community Detection Example
27

38
## Segmenting Users

docs/examples/links.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
---
2+
title: Link Prediction Example
3+
description: Friend recommendations using link prediction.
4+
---
5+
16
# Link Prediction Example
27

38
## Friend Recommendations
@@ -22,7 +27,7 @@ limit 10;
2227
```sql
2328
with
2429
aa as (select node1, node2, score as adamic_adar from onager_lnk_adamic_adar((select user1, user2 from current_friends))),
25-
jc as (select node1, node2, jaccard from onager_lnk_jaccard((select user1, user2 from current_friends))),
30+
jc as (select node1, node2, coefficient as jaccard from onager_lnk_jaccard((select user1, user2 from current_friends))),
2631
pa as (select node1, node2, score as pref_attach from onager_lnk_pref_attach((select user1, user2 from current_friends)))
2732
select aa.node1, aa.node2, aa.adamic_adar, jc.jaccard, pa.pref_attach
2833
from aa

docs/getting-started/quickstart.md

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ Calculate distances from a starting node:
7171

7272
```sql
7373
select node_id, distance
74-
from onager_pth_dijkstra((select src, dst from edges), source := 1)
74+
from onager_pth_dijkstra((select src, dst from edges), source := 1::bigint)
7575
order by distance;
7676
```
7777

@@ -80,15 +80,10 @@ order by distance;
8080
Import your edge data from any source DuckDB supports:
8181

8282
```sql
83-
-- From a CSV file
84-
create table my_edges as
85-
select *
86-
from read_csv('edges.csv');
87-
88-
-- From a Parquet file
89-
create table my_edges as
90-
select *
91-
from read_parquet('edges.parquet');
83+
-- From an existing table (ensure bigint columns)
84+
create table my_edges as select * from (values
85+
(1::bigint, 2::bigint), (2, 3), (3, 4)
86+
) t(source_id, target_id);
9287

9388
-- Run PageRank on your data
9489
select *
@@ -101,9 +96,12 @@ from onager_ctr_pagerank((select source_id as src, target_id as dst
10196
All functions expect edges as a subquery with two `bigint` columns:
10297

10398
```sql
99+
create table your_table as select * from (values (1::bigint, 2::bigint), (2, 3)) t(source_column, target_column);
100+
104101
select *
105-
from onager_function_name((select source_column as src, target_column as dst
102+
from onager_ctr_pagerank((select source_column as src, target_column as dst
106103
from your_table));
104+
-- Replace your_table and column names with your actual table and columns
107105
```
108106

109107
See the [Input Formats](../reference/input-formats.md) reference for details on node IDs, weighted functions, and directed graphs.

docs/guide/approximation.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,13 @@ create table weighted_edges as select * from (values
7474
(2, 3, 2.0), (3, 4, 1.5), (4, 1, 2.5)
7575
) t(src, dst, weight);
7676

77-
select order_idx, node_id
77+
select "order", node_id
7878
from onager_apx_tsp((select src, dst, weight from weighted_edges))
79-
order by order_idx;
79+
order by "order";
80+
8081
```
8182

82-
| Column | Type | Description |
83-
|-----------|--------|--------------------------|
84-
| order_idx | bigint | Position in the tour |
85-
| node_id | bigint | Node at this position |
83+
| Column | Type | Description |
84+
|---------|--------|--------------------------|
85+
| order | bigint | Position in the tour |
86+
| node_id | bigint | Node at this position |

0 commit comments

Comments
 (0)