Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bcf12bf393 |
6 changed files with 24 additions and 24 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
|
@ -3,5 +3,5 @@
|
|||
version = 4
|
||||
|
||||
[[package]]
|
||||
name = "epiphany-graph-rs"
|
||||
name = "norn-rs"
|
||||
version = "0.1.0"
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
[package]
|
||||
name = "epiphany-graph-rs"
|
||||
name = "norn-rs"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
description = "Hybrid Sugiyama/force-directed graph layout constraints in fast, deterministic Rust."
|
||||
description = "Norn hybrid Sugiyama/Kamada-Kawai 2D and 3D graph layout solver."
|
||||
license = "MIT OR Apache-2.0"
|
||||
repository = "https://github.com/GameCult/epiphany-graph-rs"
|
||||
keywords = ["graph", "layout", "sugiyama", "force-directed"]
|
||||
repository = "https://github.com/GameCult/norn-rs"
|
||||
keywords = ["graph", "layout", "sugiyama", "kamada-kawai"]
|
||||
categories = ["algorithms", "visualization"]
|
||||
|
||||
[dependencies]
|
||||
|
|
|
|||
10
README.md
10
README.md
|
|
@ -1,4 +1,4 @@
|
|||
# epiphany-graph-rs
|
||||
# norn-rs
|
||||
|
||||
Hybrid graph layout for DAGs that still want to breathe.
|
||||
|
||||
|
|
@ -28,7 +28,7 @@ The result is a spectrum:
|
|||
## Example
|
||||
|
||||
```rust
|
||||
use epiphany_graph_rs::{layout, Graph, LayoutConfig};
|
||||
use norn_rs::{layout, Graph, LayoutConfig};
|
||||
|
||||
let mut graph = Graph::new();
|
||||
let a = graph.add_node(1.0);
|
||||
|
|
@ -52,7 +52,7 @@ Hierarchy stays on `Y`; organic spread happens across `X/Z`; grounding and
|
|||
depth forces keep the graph shallow instead of letting it become decorative fog.
|
||||
|
||||
```rust
|
||||
use epiphany_graph_rs::{layout_3d, Graph, Layout3dConfig};
|
||||
use norn_rs::{layout_3d, Graph, Layout3dConfig};
|
||||
|
||||
let mut graph = Graph::new();
|
||||
let root = graph.add_node(1.0);
|
||||
|
|
@ -77,7 +77,7 @@ core stays small and renderer-agnostic.
|
|||
Use `Layout3dSolver` when Bevy needs to iterate layout over frames:
|
||||
|
||||
```rust
|
||||
use epiphany_graph_rs::{Graph, Layout3dConfig, Layout3dSolver};
|
||||
use norn_rs::{Graph, Layout3dConfig, Layout3dSolver};
|
||||
|
||||
let graph = Graph::new();
|
||||
let mut solver = Layout3dSolver::new(graph, Layout3dConfig::default());
|
||||
|
|
@ -121,7 +121,7 @@ Use the repulsion accuracy sweep to compare approximation settings against exact
|
|||
all-pairs repulsion on the same positions:
|
||||
|
||||
```rust
|
||||
use epiphany_graph_rs::{
|
||||
use norn_rs::{
|
||||
repulsion_accuracy_sweep, Layout3dConfig, RepulsionAccuracyCandidate,
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ use std::collections::HashMap;
|
|||
use std::fs;
|
||||
use std::path::Path;
|
||||
|
||||
use epiphany_graph_rs::{
|
||||
use norn_rs::{
|
||||
Graph, Layout3dConfig, Layout3dSolver, RepulsionAccuracyCandidate, RepulsionMode,
|
||||
evaluate_layout_quality, solver_structural_accuracy_sweep,
|
||||
};
|
||||
|
|
@ -67,7 +67,7 @@ struct Fixture {
|
|||
fn candidate_quality(
|
||||
graph: &Graph,
|
||||
candidate: &RepulsionAccuracyCandidate,
|
||||
) -> epiphany_graph_rs::LayoutQualityReport {
|
||||
) -> norn_rs::LayoutQualityReport {
|
||||
let config = Layout3dConfig {
|
||||
repulsion_mode: candidate.repulsion_mode,
|
||||
barnes_hut_theta: candidate.barnes_hut_theta,
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
use epiphany_graph_rs::{
|
||||
use norn_rs::{
|
||||
Layout3dConfig, RepulsionAccuracyCandidate, RepulsionMode, repulsion_accuracy_sweep,
|
||||
};
|
||||
|
||||
|
|
|
|||
22
src/lib.rs
22
src/lib.rs
|
|
@ -2803,18 +2803,18 @@ fn clamp(value: f32, min: f32, max: f32) -> f32 {
|
|||
///
|
||||
/// The raw ABI is intentionally tiny so browser consumers can use this crate
|
||||
/// without a binding generator. Hosts must release the pointer with
|
||||
/// [`epiphany_graph_dealloc`].
|
||||
/// [`norn_graph_dealloc`].
|
||||
#[unsafe(no_mangle)]
|
||||
pub extern "C" fn epiphany_graph_alloc(len: usize) -> *mut u8 {
|
||||
pub extern "C" fn norn_graph_alloc(len: usize) -> *mut u8 {
|
||||
let mut buffer = Vec::<u8>::with_capacity(len);
|
||||
let ptr = buffer.as_mut_ptr();
|
||||
std::mem::forget(buffer);
|
||||
ptr
|
||||
}
|
||||
|
||||
/// Release a pointer previously returned by [`epiphany_graph_alloc`].
|
||||
/// Release a pointer previously returned by [`norn_graph_alloc`].
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn epiphany_graph_dealloc(ptr: *mut u8, len: usize) {
|
||||
pub unsafe extern "C" fn norn_graph_dealloc(ptr: *mut u8, len: usize) {
|
||||
if ptr.is_null() || len == 0 {
|
||||
return;
|
||||
}
|
||||
|
|
@ -2826,16 +2826,16 @@ pub unsafe extern "C" fn epiphany_graph_dealloc(ptr: *mut u8, len: usize) {
|
|||
|
||||
/// Allocate `f32` slots for host-written typed arrays.
|
||||
#[unsafe(no_mangle)]
|
||||
pub extern "C" fn epiphany_graph_alloc_f32(count: usize) -> *mut f32 {
|
||||
pub extern "C" fn norn_graph_alloc_f32(count: usize) -> *mut f32 {
|
||||
let mut buffer = Vec::<f32>::with_capacity(count);
|
||||
let ptr = buffer.as_mut_ptr();
|
||||
std::mem::forget(buffer);
|
||||
ptr
|
||||
}
|
||||
|
||||
/// Release `f32` slots previously returned by [`epiphany_graph_alloc_f32`].
|
||||
/// Release `f32` slots previously returned by [`norn_graph_alloc_f32`].
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn epiphany_graph_dealloc_f32(ptr: *mut f32, count: usize) {
|
||||
pub unsafe extern "C" fn norn_graph_dealloc_f32(ptr: *mut f32, count: usize) {
|
||||
if ptr.is_null() || count == 0 {
|
||||
return;
|
||||
}
|
||||
|
|
@ -2847,16 +2847,16 @@ pub unsafe extern "C" fn epiphany_graph_dealloc_f32(ptr: *mut f32, count: usize)
|
|||
|
||||
/// Allocate `u32` slots for host-written typed arrays.
|
||||
#[unsafe(no_mangle)]
|
||||
pub extern "C" fn epiphany_graph_alloc_u32(count: usize) -> *mut u32 {
|
||||
pub extern "C" fn norn_graph_alloc_u32(count: usize) -> *mut u32 {
|
||||
let mut buffer = Vec::<u32>::with_capacity(count);
|
||||
let ptr = buffer.as_mut_ptr();
|
||||
std::mem::forget(buffer);
|
||||
ptr
|
||||
}
|
||||
|
||||
/// Release `u32` slots previously returned by [`epiphany_graph_alloc_u32`].
|
||||
/// Release `u32` slots previously returned by [`norn_graph_alloc_u32`].
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn epiphany_graph_dealloc_u32(ptr: *mut u32, count: usize) {
|
||||
pub unsafe extern "C" fn norn_graph_dealloc_u32(ptr: *mut u32, count: usize) {
|
||||
if ptr.is_null() || count == 0 {
|
||||
return;
|
||||
}
|
||||
|
|
@ -2876,7 +2876,7 @@ pub unsafe extern "C" fn epiphany_graph_dealloc_u32(ptr: *mut u32, count: usize)
|
|||
/// Output tuple per node is `(x, y, rank, order)` sorted by node index.
|
||||
/// Returns `0` on success and a negative value for malformed input.
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn epiphany_graph_layout_2d(
|
||||
pub unsafe extern "C" fn norn_graph_layout_2d(
|
||||
node_weights_ptr: *const f32,
|
||||
node_count: usize,
|
||||
edge_pairs_ptr: *const u32,
|
||||
|
|
|
|||
Reference in a new issue