Skip to main content

SystemRanker

Struct SystemRanker 

Source
pub struct SystemRanker<'a> { /* private fields */ }
Expand description

Personalized PageRank over the HETEROGENEOUS entity reference graph.

Nodes are every rankable entity (id-sorted for determinism): symbols, components, subsystems, services, flows, contracts, state, reactive, routes, topics, queues, stores, schemas and files. Edges are trusted relationships whose both endpoints are rankable entities and whose predicate normalizes to a reference kind; weights follow the spec formula. The global vector is computed once per epoch (Main caches the SystemRanker); task vectors personalize from TaskSeeds with a warm start blended from the global vector.

Implementations§

Source§

impl<'a> SystemRanker<'a>

Source

pub fn new(view: &'a TrustedGraphView<'a>) -> SystemRanker<'a>

Build the ranker from the trusted view. Deterministic; O(E) edges.

Source

pub fn with_edge_adjust<F>( view: &'a TrustedGraphView<'a>, adjust: F, ) -> SystemRanker<'a>
where F: for<'x, 'y, 'z> Fn(&'x str, &'y str, &'z str, f64) -> Option<(String, f64)>,

Build the ranker with a per-edge weight adjust hook (DoD 23): adjust(subject, predicate, object, base) -> Option<(mode, value)>. Modes: add | multiply | replace | veto. None keeps the base weight. Veto (or non-positive/non-finite result) drops the edge. Deterministic for a deterministic hook; every other construction step is unchanged.

Source

pub fn nodes(&self) -> &[String]

Rankable entity ids in rank order (index i in every vector maps to nodes()[i]; symbols are a subset).

Source

pub fn symbols(&self) -> Vec<String>

Ranked symbol entity ids (subset of SystemRanker::nodes), id-sorted. Symbol-only callers use this to walk the symbol slice of the heterogeneous vectors.

Source

pub fn index_of(&self, id: &str) -> Option<usize>

Node index for a rankable entity id, if it is in the universe.

Source

pub fn in_degree(&self, id: &str) -> usize

Distinct referencing sources of a node id (0 when absent).

Source

pub fn global_vector(&self) -> Vec<f64>

Precomputed global PageRank vector (architecturally seeded; see SystemRanker::global_personalization). Main caches the ranker per epoch and reads this.

Source

pub fn project_to_symbols(&self, vector: &[f64]) -> Vec<(String, f64)>

Project the heterogeneous node scores to surface-relevant symbol scores: a symbol’s score = its own score + 0.4 × the sum of the scores of the entities it OWNS/REGISTERS/PUBLISHES/READS/WRITES/ PARTICIPATES_IN/HANDLES/DEFINES, with the total bonus capped at 0.5. This is how component/flow/contract/state importance reaches the surface — and, via the HANDLES/DEFINES projection, how a hot Route/Schema node (task seed or PPR) reaches its handler/definer symbol. Deterministic: nodes and projection edges are id-sorted.

Returns (symbol id, projected score) pairs, id-sorted.

Source

pub fn task_vector(&self, seeds: &[TaskSeed]) -> Vec<f64>

Task-personalized PageRank vector. Seeds come from TaskSeeds whose id is a rankable entity id; the seed vector carries weight at each matched index. Warm start: 0.3 × global + 0.7 × normalized seeds. Unresolvable seed sets fall back to the global vector (never panic).

Auto Trait Implementations§

§

impl<'a> Freeze for SystemRanker<'a>

§

impl<'a> RefUnwindSafe for SystemRanker<'a>

§

impl<'a> Send for SystemRanker<'a>

§

impl<'a> Sync for SystemRanker<'a>

§

impl<'a> Unpin for SystemRanker<'a>

§

impl<'a> UnsafeUnpin for SystemRanker<'a>

§

impl<'a> UnwindSafe for SystemRanker<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.