MCPcopy Create free account
hub / github.com/Pometry/Raphtory / top_k

Method top_k

raphtory/src/python/graph/node_state/node_state_earliest_time.rs:427–437  ·  view source on GitHub ↗

Compute the k largest values Arguments: k (int): The number of values to return Returns: NodeStateOptionDateTime: The k largest values as a node state

(
        &self,
        k: usize,
    )

Source from the content-addressed store, hash-verified

425 /// Returns:
426 /// NodeStateOptionDateTime: The k largest values as a node state
427 fn top_k(
428 &self,
429 k: usize,
430 ) -> Result<NodeState<'static, Option<DateTime<Utc>>, DynamicGraph>, TimeError> {
431 self.compute().map(|ns| {
432 ns.top_k_by(
433 |a, b| a.cmp(b), // None values are always Less than Some(_)
434 k,
435 )
436 })
437 }
438
439 /// Compute the k smallest values
440 ///

Callers

nothing calls this directly

Calls 4

top_k_byMethod · 0.80
mapMethod · 0.45
computeMethod · 0.45
cmpMethod · 0.45

Tested by

no test coverage detected