Get the edge count for a specific label. O(E) unless cached. Returns 0 if the label doesn't exist.
(&self, label: &str)
| 160 | /// |
| 161 | /// Returns 0 if the label doesn't exist. |
| 162 | pub fn label_edge_count(&self, label: &str) -> usize { |
| 163 | let Some(lid) = self.label_id(label) else { |
| 164 | return 0; |
| 165 | }; |
| 166 | |
| 167 | let n = self.node_count(); |
| 168 | let mut count = 0usize; |
| 169 | for node in 0..n { |
| 170 | for (l, _dst) in self.dense_iter_out(node as u32) { |
| 171 | if l == lid { |
| 172 | count += 1; |
| 173 | } |
| 174 | } |
| 175 | } |
| 176 | count |
| 177 | } |
| 178 | |
| 179 | /// Estimate the selectivity of a label: edge_count / total_edges. |
| 180 | /// |
no test coverage detected