Add Graph::new()

This commit is contained in:
2025-10-08 17:04:25 +02:00
parent 679b597f92
commit 66e1498c76
2 changed files with 9 additions and 6 deletions
+8
View File
@@ -26,6 +26,14 @@ pub struct Graph {
// TODO: Add iterator of edges.
// TODO: Add iterator of vertex neighbors, see 'fn add_adjacent()'.
impl Graph {
pub fn new() -> Graph {
Graph {
incidence_headers: vec![],
next_incidences: vec![],
incidence_vertices: vec![],
}
}
pub fn vertex_count(&self) -> usize {
self.incidence_headers.len()
}