Initial release #1

Merged
warrence merged 102 commits from dev into main 2026-06-30 10:26:52 +02:00
2 changed files with 9 additions and 6 deletions
Showing only changes of commit 66e1498c76 - Show all commits
+1 -6
View File
@@ -6,12 +6,7 @@ use models::Vertex;
fn main() {
// TODO: Move this graph example into one or more tests.
let mut graph = Graph {
// TODO: The initializations should happen in an initializer or constructor
incidence_headers: vec![],
next_incidences: vec![],
incidence_vertices: vec![],
};
let mut graph = Graph::new();
let vertices: [Vertex; 10] = core::array::from_fn(|_| graph.add_vertex());
graph.add_edge(vertices[0], vertices[1]);
graph.add_edge(vertices[1], vertices[2]);
+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()
}