#![allow(unused)]

use dyntri_core::graph::observables::{asd, bfs::bfs_sphere_volumes};
use dyntri_edt2d::generator::random_uniform_triangulation;
use rand::SeedableRng;
use rand_xoshiro::Xoshiro256StarStar;

const NUM_TRIANGLES: usize = 2_usize.pow(10);
const ORIGIN: usize = 0;
const MAX_DISTANCE: u16 = 10;

fn main() {
    let mut rng = Xoshiro256StarStar::seed_from_u64(42);
    // Generate an 2D EDT triangulation using direct sampling (as [`PlanarMap`])
    let planar_map = random_uniform_triangulation(NUM_TRIANGLES, &mut rng);

    // Construct [`Triangulation2D`] of the triangulation
    let triangulation = planar_map.construct_triangulation();
    // Check the Euler characteristic formula for spherical topology
    assert_eq!(triangulation.num_vertices(), NUM_TRIANGLES / 2 + 2);

    // Get the vertex graph of the triangulation
    let graph = triangulation.vertex_graph();
    // Alternatively construct it directly from the PlanarMap (this is faster)
    let graph = planar_map.construct_vertex_graph();

    // Measure the sphere (shell) volume profile around `ORIGIN`
    let asd = asd::asd(&graph, ORIGIN, 10);
    println!("{:?}", asd);
    let spherevol_profile = bfs_sphere_volumes(&graph, ORIGIN, MAX_DISTANCE);
    println!("{:?}", spherevol_profile);
}
