graph-force/src/lib.rs

22 lines
509 B
Rust
Raw Normal View History

2022-11-20 14:18:06 +00:00
mod layout;
mod utils;
mod spring_model;
mod my_model;
mod graph;
2022-11-20 13:49:43 +00:00
use pyo3::prelude::*;
/// Formats the sum of two numbers as string.
#[pyfunction]
2022-11-20 14:18:06 +00:00
fn layout_from_edge_list(number_of_nodes: usize, edges: Vec<(u32, u32)>) -> PyResult<Vec<(f32, f32)>> {
Ok(
layout::layout(number_of_nodes, edges)
)
2022-11-20 13:49:43 +00:00
}
/// A Python module implemented in Rust.
#[pymodule]
2022-11-20 14:18:06 +00:00
fn graph_force(_py: Python, m: &PyModule) -> PyResult<()> {
m.add_function(wrap_pyfunction!(layout_from_edge_list, m)?)?;
2022-11-20 13:49:43 +00:00
Ok(())
}