1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
//! # Dynamical Triangulation
//! Dynamical Triangulation (DT) in Rust.
//!
//! The `dyntri-core` crate aims to form a base and provide standard triangulation
//! and graph structures, which DT generators can use to provide interoperability
//! and make use of the provided observables.
//! This crate provides triangulation functionality for arbirary dimensions using Rust _const generics_.
//!
//! ## Triangulation Generators
//! Currently, there are two companion crates [`dyntri-edt2d`](https://crates.io/crates/dyntri-edt2d)
//! and [`dyntri-cdt2d`](https://crates.io/crates/dyntri-cdt2d) that provide implementations
//! of 2D Euclidean and Causal Dynamical Triangulation (EDT/CDT) generators respectively.
//!
//! ## Using the crate
//! The central structures of this crate are the [Triangulation](triangulation::Triangulation)
//! and [CausalTriangulation](triangulation::CausalTriangulation), providing
//! the base functionality to work with triangulations. These are designed to work for any dimension,
//! and there are also aliases for the most common use cases:
//! - [Triangulation2D](triangulation::Triangulation2D)
//! - [Triangulation3D](triangulation::Triangulation3D)
//! - [Triangulation4D](triangulation::Triangulation4D)
//! - [CausalTriangulation2D](triangulation::CausalTriangulation2D)
//! - [CausalTriangulation3D](triangulation::CausalTriangulation3D)
//! - [CausalTriangulation4D](triangulation::CausalTriangulation4D)
//!
//! Additionally, there is the [Graph](graph::Graph) structure, which provides a standard graph
//! implementation. This [Graph](graph::Graph) implements most of the interesting
//! [quantities/observables](graph::observables), like the sphere volume profile and the
//! average sphere distance, as well as many breadth-first search functions that can be used
//! for many distance based measurements like correlations.
//!
//! ## Example of use
//! Here is an example using the [`dyntri-edt2d`](https://crates.io/crates/dyntri-edt2d)
//! generator. Crucially a [Triangulation2D](triangulation::Triangulation2D)
//! `triangulation` is constructed, which can then be used to perform any measurement one would like.
//! ```
//! use dyntri_edt2d::generator::random_uniform_triangulation;
//! use dyntri_core::graph::observables::asd;
//! # use rand::SeedableRng;
//! use rand_xoshiro::Xoshiro256StarStar;
//!
//! // Create RNG
//! let mut rng = Xoshiro256StarStar::seed_from_u64(42);
//!
//! // Generate an 2D EDT triangulation using direct sampling (as [`PlanarMap`])
//! let planar_map = random_uniform_triangulation(1000, &mut rng);
//! // Construct triangulation
//! let triangulation = planar_map.construct_triangulation();
//! // Check the Euler characteristic formula for spherical topology
//! assert_eq!(triangulation.num_vertices(), 1000 / 2 + 2);
//!
//! // Get the vertex graph of the triangulation
//! let graph = triangulation.vertex_graph();
//! // Measure the average sphere distance (epsilon=0)
//! let asd = asd::asd(&graph, 0, 10);
//! println!("{:?}", asd);
//! ```
//!
//! ## Implementing custom generator
//! To make use of `dyntri-core` using a custom generator, all one needs to do is implement
//! a function to construct a [Triangulation](triangulation::Triangulation) or
//! [CausalTriangulation2D](triangulation::CausalTriangulation) from
//! whatever generator one has.
//! From these all the functionality coming from this crate is available.
//! If so desired one can also directly implement the construction of a [Graph](graph::Graph)
//! from one's generator, which may be more effecient then indirectly constructing it
//! from a triangulation.