Skip to content

Commit e7c6bb5

Browse files
konardclaude
andcommitted
Add links-notation API experiment
Replace old experiment files with a cleaner example demonstrating how to use the links-notation crate API for parsing LiNo format (doublets, triplets, named links, and multiple links). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 4526b49 commit e7c6bb5

File tree

6 files changed

+118
-68
lines changed

6 files changed

+118
-68
lines changed

experiments/Cargo.toml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[package]
2+
name = "lino-api-test"
3+
version = "0.1.0"
4+
edition = "2021"
5+
publish = false
6+
7+
[dependencies]
8+
links-notation = "0.13.0"
9+
10+
# Note: doublets crate requires nightly Rust due to unstable features
11+
# Uncomment to test with nightly: rustup run nightly cargo build
12+
# doublets = "0.1.0-pre"

experiments/README.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Experiments
2+
3+
This folder contains experiments for testing Links Theory dependencies.
4+
5+
## LiNo API Test (`src/main.rs`)
6+
7+
Demonstrates how to use the `links-notation` crate to parse Links Notation (LiNo) format:
8+
9+
- Simple doublet format: `(1 2)`
10+
- Triplet format: `(A connects B)`
11+
- Named links: `(link1: 1 2)`
12+
- Multiple links: `(1 2) (2 3) (3 1)`
13+
14+
### Running
15+
16+
```bash
17+
cd experiments
18+
cargo run
19+
```
20+
21+
## Notes on `doublets` crate
22+
23+
The `doublets` crate (from [linksplatform/doublets-rs](https://github.com/linksplatform/doublets-rs)) provides persistent storage for doublet-links but requires nightly Rust due to unstable features like `step_trait` and `trait_alias`.
24+
25+
To experiment with it, use nightly Rust:
26+
27+
```bash
28+
rustup run nightly cargo build
29+
```
30+
31+
The main `network-isomorphism-solver` library uses stable Rust and in-memory storage for broader compatibility.

experiments/debug_xor.rs

Lines changed: 0 additions & 43 deletions
This file was deleted.

experiments/src/main.rs

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
use links_notation::{parse_lino, LiNo};
2+
3+
fn main() {
4+
// Test parsing simple links notation
5+
println!("Testing links-notation crate...\n");
6+
7+
// Simple doublet format
8+
let input = "(1 2)";
9+
println!("Input: {}", input);
10+
match parse_lino(input) {
11+
Ok(result) => {
12+
println!("Parsed: {:?}", result);
13+
explore_lino(&result);
14+
}
15+
Err(e) => {
16+
println!("Error: {:?}", e);
17+
}
18+
}
19+
20+
// Triplet format
21+
let input2 = "(A connects B)";
22+
println!("\nInput: {}", input2);
23+
match parse_lino(input2) {
24+
Ok(result) => {
25+
println!("Parsed: {:?}", result);
26+
explore_lino(&result);
27+
}
28+
Err(e) => {
29+
println!("Error: {:?}", e);
30+
}
31+
}
32+
33+
// Named link
34+
let input3 = "(link1: 1 2)";
35+
println!("\nInput: {}", input3);
36+
match parse_lino(input3) {
37+
Ok(result) => {
38+
println!("Parsed: {:?}", result);
39+
explore_lino(&result);
40+
}
41+
Err(e) => {
42+
println!("Error: {:?}", e);
43+
}
44+
}
45+
46+
// Multiple links
47+
let input4 = "(1 2) (2 3) (3 1)";
48+
println!("\nInput: {}", input4);
49+
match parse_lino(input4) {
50+
Ok(result) => {
51+
println!("Parsed: {:?}", result);
52+
explore_lino(&result);
53+
}
54+
Err(e) => {
55+
println!("Error: {:?}", e);
56+
}
57+
}
58+
}
59+
60+
fn explore_lino(lino: &LiNo<String>) {
61+
println!(" is_link: {}", lino.is_link());
62+
println!(" is_ref: {}", lino.is_ref());
63+
64+
match lino {
65+
LiNo::Ref(r) => {
66+
println!(" -> Ref: {:?}", r);
67+
}
68+
LiNo::Link { id, values } => {
69+
println!(" -> Link id: {:?}, values count: {}", id, values.len());
70+
for (i, val) in values.iter().enumerate() {
71+
println!(" value[{}]: {:?}", i, val);
72+
}
73+
}
74+
}
75+
}

experiments/test_path

-5.06 MB
Binary file not shown.

experiments/test_path.rs

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)