egraph-rs-system-patterns
Core architectural and implementation patterns of layouts, clustering, layering, and triangulation in egraph-rs.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Core architectural and implementation patterns of layouts, clustering, layering, and triangulation in egraph-rs.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Commands and procedures to format, lint, and run tests for Rust, WebAssembly, Python, and JS/TS in the egraph-rs project.
Conventions and format rules for writing commit messages in the egraph-rs project.
Guidelines for general development process, coding style, writing comments, and updating skills after tasks in the egraph-rs project.
| name | egraph-rs-system-patterns |
| description | Core architectural and implementation patterns of layouts, clustering, layering, and triangulation in egraph-rs. |
This skill details the architectural design and algorithms used across the egraph-rs library. Use this skill when modifying, maintaining, or implementing core algorithms (SGD, MDS, community detection, layering, triangulation, etc.) or cross-language bindings.
Modular Crate Structure
Key Patterns
CommunityDetection, LayeringAlgorithm)Force-directed layout with a unified concrete implementation.
Sgd<S> struct rather than a trait-based design for efficiency.pub struct Sgd<S> {
node_pairs: Vec<(usize, usize, S, S, S, S)>, // (i, j, dij, dji, wij, wji)
epsilon: S, // Stability parameter
eta_min: S, // Minimum learning rate (calculated from weights)
eta_max: S, // Maximum learning rate (calculated from weights)
}
pub trait Scheduler<S> {
fn run<F: FnMut(S)>(&mut self, callback: &mut F);
fn step<F: FnMut(S)>(&mut self, callback: &mut F);
fn is_finished(&self) -> bool;
}
Computes spectral embeddings using the graph Laplacian.
crates/linalg/rdmds/pub struct RdMds<S> {
pub d: usize,
pub shift: S,
pub eigenvalue_max_iterations: usize,
pub cg_max_iterations: usize,
pub eigenvalue_tolerance: S,
pub cg_tolerance: S,
}
Generates node pairs for SGD from spectral embeddings.
crates/layout/omega/pub struct Omega<S> {
pub k: usize, // Random pairs per node
pub min_dist: S, // Min distance
}
Diffusion kernel-based SGD using exp(-tL) kernel.
crates/layout/kernel-sgd/ and crates/linalg/spmv/power_method.rs: Estimates maximum eigenvalue of graph Laplacianchebyshev.rs: Approximates exp(-tL) using Chebyshev polynomialshutchinson.rs: Trace estimatordiffusion_kernel.rs: Random access interface (provides K[i, j] query in O(num_vectors) time)kernel_sgd.rs: Builder pattern and integrationtrait CommunityDetection<G> {
fn detect_communities(&self, graph: G) -> HashMap<G::NodeId, usize>;
}
trait LayeringAlgorithm<N, E, Ix: IndexType> {
fn assign_layers(&self, graph: &Graph<N, E, Directed, Ix>) -> HashMap<NodeIndex<Ix>, usize>;
}
spade library to calculate 2D Euclidean triangulation.