Get statistics about this graph.
(&self)
| 377 | |
| 378 | /// Get statistics about this graph. |
| 379 | pub fn stats(&self) -> GraphStats { |
| 380 | let mut zombie_count = 0; |
| 381 | let mut empty_count = 0; |
| 382 | |
| 383 | for v in &self.vertices { |
| 384 | if v.is_zombie() { |
| 385 | zombie_count += 1; |
| 386 | } |
| 387 | if v.is_empty() { |
| 388 | empty_count += 1; |
| 389 | } |
| 390 | } |
| 391 | |
| 392 | GraphStats { |
| 393 | vertex_count: self.vertices.len(), |
| 394 | child_count: self.children.len(), |
| 395 | total_bytes: self.total_bytes, |
| 396 | zombie_count, |
| 397 | empty_vertex_count: empty_count, |
| 398 | } |
| 399 | } |
| 400 | |
| 401 | /// Clear the graph, removing all vertices and children. |
| 402 | /// |