Create a new result batch for the given algorithm.
(algorithm: GraphAlgorithm)
| 34 | impl AlgoResultBatch { |
| 35 | /// Create a new result batch for the given algorithm. |
| 36 | pub fn new(algorithm: GraphAlgorithm) -> Self { |
| 37 | let schema = algorithm.result_schema(); |
| 38 | let mut text_count = 0usize; |
| 39 | let mut f64_count = 0usize; |
| 40 | let mut i64_count = 0usize; |
| 41 | let mut column_map = Vec::with_capacity(schema.len()); |
| 42 | |
| 43 | for &(_, col_type) in schema { |
| 44 | match col_type { |
| 45 | AlgoColumnType::Text => { |
| 46 | column_map.push((col_type, text_count)); |
| 47 | text_count += 1; |
| 48 | } |
| 49 | AlgoColumnType::Float64 => { |
| 50 | column_map.push((col_type, f64_count)); |
| 51 | f64_count += 1; |
| 52 | } |
| 53 | AlgoColumnType::Int64 => { |
| 54 | column_map.push((col_type, i64_count)); |
| 55 | i64_count += 1; |
| 56 | } |
| 57 | } |
| 58 | } |
| 59 | |
| 60 | Self { |
| 61 | algorithm, |
| 62 | text_columns: vec![Vec::new(); text_count], |
| 63 | f64_columns: vec![Vec::new(); f64_count], |
| 64 | i64_columns: vec![Vec::new(); i64_count], |
| 65 | column_map, |
| 66 | row_count: 0, |
| 67 | } |
| 68 | } |
| 69 | |
| 70 | /// Add a row with node_id and f64 score (PageRank, SSSP, LCC, centrality). |
| 71 | pub fn push_node_f64(&mut self, node_id: String, value: f64) { |
nothing calls this directly
no test coverage detected