Module ring

Module ring 

Source
Expand description

Ring Topology for Trajectory Memory

Provides a circular structure for organizing episodes in a trajectory. Inspired by RCP (Ring Contextual Propagation) which uses ring topology for multi-scale context organization.

§Key Properties

  • Circular ordering: Enables wraparound attention
  • O(1) neighbor access: Adjacent elements in constant time
  • Ring distance: Shortest path in either direction
  • Cache-friendly: Contiguous storage in Vec

§Usage

use rag_plusplus_core::trajectory::Ring;

let ring = Ring::new(vec![1, 2, 3, 4, 5]);

// Get neighbors
let neighbors: Vec<_> = ring.neighbors(0, 2).collect();

// Ring distance (shortest path)
let dist = ring.ring_distance(0, 3); // min(3, 2) = 2

Structs§

DualRing
Dual Ring Structure for IRCP/RCP
DualRingNode
A node in a dual ring with both temporal position and influence weight.
Ring
A ring topology over a collection of elements.
RingNode
A node in a ring with additional metadata.

Functions§

build_dual_ring
Build a dual ring from episodes with temporal positions and influence scores.
build_dual_ring_with_attention
Build a dual ring with full attention data.
build_weighted_ring
Build a ring from a sequence of episodes with computed weights.

Type Aliases§

EpisodeRing
Ring of episodes for multi-scale trajectory organization.