pub mod algorithms;
pub mod analysis;
pub mod clustering;
pub mod layouts;
pub mod visualization;
pub use algorithms::*;
pub use analysis::*;
pub use clustering::*;
pub use layouts::*;
pub use visualization::*;
#[derive(Debug, Clone, PartialEq)]
pub struct GraphNode {
pub id: String,
pub x: f64,
pub y: f64,
pub weight: f64,
pub color: String,
pub size: f64,
pub label: String,
}
impl GraphNode {
pub fn new(id: &str, x: f64, y: f64) -> Self {
Self {
id: id.to_string(),
x,
y,
weight: 1.0,
color: "#000000".to_string(),
size: 10.0,
label: id.to_string(),
}
}
pub fn set_color(&mut self, color: &str) {
self.color = color.to_string();
}
pub fn set_size(&mut self, size: f64) {
self.size = size;
}
pub fn set_label(&mut self, label: &str) {
self.label = label.to_string();
}
}
#[derive(Debug, Clone)]
pub struct GraphEdge {
pub source: String,
pub target: String,
pub weight: f64,
pub color: String,
pub width: f64,
pub label: String,
}
impl GraphEdge {
pub fn new(source: &str, target: &str, weight: f64) -> Self {
Self {
source: source.to_string(),
target: target.to_string(),
weight,
color: "#000000".to_string(),
width: 1.0,
label: String::new(),
}
}
pub fn set_color(&mut self, color: &str) {
self.color = color.to_string();
}
pub fn set_width(&mut self, width: f64) {
self.width = width;
}
pub fn set_label(&mut self, label: &str) {
self.label = label.to_string();
}
}
#[derive(Debug, Clone)]
pub struct CentralityMeasures {
pub degree_centrality: f64,
pub betweenness_centrality: f64,
pub closeness_centrality: f64,
}
#[derive(Debug, Clone)]
pub struct NetworkMetrics {
pub node_count: usize,
pub edge_count: usize,
pub density: f64,
pub clustering_coefficient: f64,
pub average_path_length: f64,
}
#[derive(Debug, Clone)]
pub struct VisualizationMetrics {
pub edge_crossings: usize,
pub node_overlaps: usize,
pub layout_quality: f64,
}