Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/dist_pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ on:
paths-ignore:
- '**.md'
- 'docs/**'
- '.github/**'
push:
tags:
- 'v*'
Expand Down Expand Up @@ -42,6 +41,7 @@ jobs:
name: Create Draft Release with Built Binaries
needs:
- duckdb-stable-build
- duckdb-next-stable-build
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
permissions:
Expand All @@ -50,6 +50,7 @@ jobs:
- name: Download All Build Artifacts
uses: actions/download-artifact@v4
with:
pattern: onager-*
path: dist
merge-multiple: true
- name: List Artifacts
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/lints.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ on:
paths-ignore:
- '**.md'
- 'docs/**'
- '.github/**'

permissions:
contents: read
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ on:
paths-ignore:
- '**.md'
- 'docs/**'
- '.github/**'
push:
branches:
- main
Expand Down
2 changes: 1 addition & 1 deletion ROADMAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ It outlines features to be implemented and their current status.
### 9. Minimum Spanning Tree

* [x] Kruskal's algorithm
* [ ] Prim's algorithm
* [x] Prim's algorithm

### 10. Link Prediction

Expand Down
8 changes: 8 additions & 0 deletions docs/assets/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions docs/guide/links.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,30 @@ order by score desc limit 10;

---

## Common Neighbors

Simply counts the number of shared neighbors between two nodes.
The most basic link prediction heuristic — nodes with many common friends are likely to become friends.

\[
CN(u, v) = |N(u) \cap N(v)|
\]

```sql
select node1, node2, count as common_neighbors
from onager_lnk_common_neighbors((select src, dst from edges))
where count > 0
order by count desc limit 10;
```

| Column | Type | Description |
|--------|--------|----------------------------------|
| node1 | bigint | First node |
| node2 | bigint | Second node |
| count | bigint | Number of shared neighbors |

---

## Complete Example: Friend Recommendations

Find potential connections in a social network:
Expand Down
36 changes: 36 additions & 0 deletions docs/guide/mst.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,39 @@ order by weight;
| src | bigint | Source node |
| dst | bigint | Destination node |
| weight | double | Edge weight |

---

## Prim's Algorithm

Prim's algorithm builds the MST by starting from an arbitrary node and repeatedly adding the minimum weight edge that connects a new node.

```sql
select src, dst, weight
from onager_mst_prim((select src, dst, weight from weighted_edges))
order by weight;
```

| Column | Type | Description |
|--------|--------|-------------------|
| src | bigint | Source node |
| dst | bigint | Destination node |
| weight | double | Edge weight |

---

## Comparison

Both algorithms produce optimal minimum spanning trees but differ in approach:

- **Kruskal's**: Sorts all edges globally which is best for sparse graphs
- **Prim's**: Grows tree from a starting node which is best for dense graphs

```sql
-- Both return the same total weight
select 'Kruskal' as algorithm, sum(weight) as total_weight
from onager_mst_kruskal((select src, dst, weight from weighted_edges))
union all
select 'Prim', sum(weight)
from onager_mst_prim((select src, dst, weight from weighted_edges));
```
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ Onager currently includes the following graph algorithms:
| Subgraphs | Ego graph, k-hop neighbors, and induced subgraph |
| Generators | Erdős-Rényi, Barabási-Albert, and Watts-Strogatz |
| Approximation | Max clique, independent set, vertex cover, and TSP |
| MST | Kruskal's algorithm |
| MST | Kruskal's and Prim's algorithms |
| Parallel | PageRank, BFS, shortest paths, connected components, clustering, and triangle counting |

## Get Started
Expand Down
3 changes: 2 additions & 1 deletion docs/reference/input-formats.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ select onager_node_in_degree('social', 1);

- `onager_pth_bellman_ford` — shortest paths with negative weights
- `onager_pth_floyd_warshall` — all-pairs shortest paths
- `onager_mst_kruskal` — minimum spanning tree
- `onager_mst_kruskal` — minimum spanning tree (Kruskal's)
- `onager_mst_prim` — minimum spanning tree (Prim's)
- `onager_apx_tsp` — traveling salesman approximation

Pass weights like this:
Expand Down
1 change: 1 addition & 0 deletions docs/reference/sql-functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ Complete reference for all Onager SQL functions.
| Function | Returns | Description |
|--------------------------------------|--------------------|---------------|
| `onager_mst_kruskal(weighted_edges)` | `src, dst, weight` | Kruskal's MST |
| `onager_mst_prim(weighted_edges)` | `src, dst, weight` | Prim's MST |

## Generator Functions

Expand Down
27 changes: 27 additions & 0 deletions docs/stylesheets/extra.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/* Custom styles for Onager documentation */

/* Improve code block readability */
.highlight .hll {
background-color: var(--md-code-hl-color);
}

/* Better spacing for admonitions */
.admonition {
margin: 1.5625em 0;
}

/* Improve table styling */
table {
display: table;
width: 100%;
}

/* Better link styling */
a:hover {
text-decoration: underline;
}

/* Code annotation improvements */
.md-annotation__index {
cursor: pointer;
}
114 changes: 99 additions & 15 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,42 +6,87 @@ site_url: https://cogitatortech.github.io/onager/

theme:
name: material
logo: assets/logo.svg
favicon: assets/logo.svg
palette:
# Light mode
- media: "(prefers-color-scheme: light)"
scheme: default
primary: deep purple
accent: amber
toggle:
icon: material/brightness-7
icon: material/weather-night
name: Switch to dark mode
# Dark mode
- media: "(prefers-color-scheme: dark)"
scheme: slate
primary: deep purple
accent: amber
toggle:
icon: material/brightness-4
icon: material/weather-sunny
name: Switch to light mode
font:
text: Inter
code: JetBrains Mono
icon:
repo: fontawesome/brands/github
annotation: material/arrow-right-circle
features:
- content.code.copy
# Navigation
- navigation.instant
- navigation.instant.prefetch
- navigation.instant.progress
- navigation.tracking
- navigation.tabs
- navigation.tabs.sticky
- navigation.sections
- navigation.expand
- navigation.path
- navigation.top
- navigation.footer
- navigation.indexes
- navigation.expand
# Table of contents
- toc.follow
# Search
- search.suggest
- search.highlight
- search.share
# Content
- content.code.copy
- content.code.select
- content.code.annotate
- navigation.tracking
- navigation.sections
- content.tabs.link
- content.tooltips
# Header
- header.autohide
- announce.dismiss

extra:
social:
- icon: fontawesome/brands/github
link: https://github.com/CogitatorTech/onager
name: Onager on GitHub
generator: false
analytics:
feedback:
title: Was this page helpful?
ratings:
- icon: material/emoticon-happy-outline
name: This page was helpful
data: 1
note: Thanks for your feedback!
- icon: material/emoticon-sad-outline
name: This page could be improved
data: 0
note: Thanks for your feedback! Help us improve by opening an issue.

extra_css:
- stylesheets/extra.css

plugins:
- search
- search:
separator: '[\s\-,:!=\[\]()"/]+|(?!\b)(?=[A-Z][a-z])|\.(?!\d)|&[lg]t;'
- tags

nav:
- Home: index.md
Expand Down Expand Up @@ -71,18 +116,57 @@ nav:
- Input Formats: reference/input-formats.md

markdown_extensions:
- pymdownx.highlight:
anchor_linenums: true
- pymdownx.inlinehilite
- pymdownx.snippets
- pymdownx.superfences
- pymdownx.details
- pymdownx.arithmatex:
generic: true
# Python Markdown
- abbr
- admonition
- attr_list
- def_list
- footnotes
- md_in_html
- tables
- toc:
permalink: true
permalink_title: Anchor link to this section
toc_depth: 3
# PyMdownx
- pymdownx.arithmatex:
generic: true
- pymdownx.betterem:
smart_enable: all
- pymdownx.caret
- pymdownx.critic
- pymdownx.details
- pymdownx.emoji:
emoji_index: !!python/name:material.extensions.emoji.twemoji
emoji_generator: !!python/name:material.extensions.emoji.to_svg
- pymdownx.highlight:
anchor_linenums: true
line_spans: __span
pygments_lang_class: true
auto_title: false
- pymdownx.inlinehilite
- pymdownx.keys
- pymdownx.magiclink:
normalize_issue_symbols: true
repo_url_shorthand: true
user: CogitatorTech
repo: onager
- pymdownx.mark
- pymdownx.smartsymbols
- pymdownx.snippets:
base_path: docs
check_paths: true
- pymdownx.superfences:
custom_fences:
- name: mermaid
class: mermaid
format: !!python/name:pymdownx.superfences.fence_code_format
- pymdownx.tabbed:
alternate_style: true
combine_header_slug: true
- pymdownx.tasklist:
custom_checkbox: true
- pymdownx.tilde

extra_javascript:
- assets/js/mathjax.js
Expand Down
2 changes: 1 addition & 1 deletion onager/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "onager"
version = "0.1.0-alpha.5"
version = "0.1.0-alpha.4"
edition = "2021"
publish = false
description = "A Graph Analytics Toolbox for DuckDB"
Expand Down
Loading
Loading