Get statistics about this graph.
(&self)
| 354 | |
| 355 | /// Get statistics about this graph. |
| 356 | pub fn stats(&self) -> GraphStats { |
| 357 | let mut zombie_count = 0; |
| 358 | let mut empty_count = 0; |
| 359 | |
| 360 | for v in &self.vertices { |
| 361 | if v.is_zombie() { |
| 362 | zombie_count += 1; |
| 363 | } |
| 364 | if v.is_empty() { |
| 365 | empty_count += 1; |
| 366 | } |
| 367 | } |
| 368 | |
| 369 | GraphStats { |
| 370 | vertex_count: self.vertices.len(), |
| 371 | child_count: self.children.len(), |
| 372 | total_bytes: self.total_bytes, |
| 373 | zombie_count, |
| 374 | empty_vertex_count: empty_count, |
| 375 | } |
| 376 | } |
| 377 | |
| 378 | /// Clear the graph, removing all vertices and children. |
| 379 | /// |