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

Method top_k

raphtory/src/python/graph/node_state/node_state_latest_time.rs:474–484  ·  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

472 /// Returns:
473 /// NodeStateOptionDateTime: The k largest values as a node state
474 fn top_k(
475 &self,
476 k: usize,
477 ) -> Result<NodeState<'static, Option<DateTime<Utc>>, DynamicGraph>, TimeError> {
478 self.compute().map(|ns| {
479 ns.top_k_by(
480 |a, b| a.cmp(b), // None values are always Less than Some(_)
481 k,
482 )
483 })
484 }
485
486 /// Compute the k smallest values
487 ///

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