Skip to main content

GraphMut

Struct GraphMut 

Source
pub struct GraphMut<'a> {
    pub ids: &'a IdMap,
    pub syms: &'a mut Interner,
    pub labels: &'a [u32],
    pub props: ColumnsView<'a>,
    pub topo: &'a mut Topology,
    pub base_topo: Option<&'a ArchivedCsr>,
    pub edge_props: &'a mut EdgeProps,
}
Expand description

Borrowed mutable view of graph state the engine writes derived edges into.

Fields§

§ids: &'a IdMap§syms: &'a mut Interner§labels: &'a [u32]§props: ColumnsView<'a>§topo: &'a mut Topology

Edges written since the snapshot. Reads must go through GraphMut::neighbors, not this field: on a store opened from a snapshot the overlay is empty and every edge lives in base_topo.

§base_topo: Option<&'a ArchivedCsr>

The snapshot’s archived CSR, when one is open. None for a store with no snapshot, where topo already holds everything.

§edge_props: &'a mut EdgeProps

Implementations§

Source§

impl GraphMut<'_>

Source

pub fn add_edge(&mut self, etype: u32, src: u32, dst: u32) -> bool

Add a derived edge, reporting whether it was not there before — counting the snapshot’s edges as well as the overlay’s.

Topology::add_edge looks at the overlay alone. On a store opened from a snapshot, an edge one rule derived before the snapshot lives in the base, so a second rule over the same edge type that desires it was told it was new: it recorded the edge as its own beside the first rule, the edge was counted twice, and when the second rule let go of it the edge went from the graph while the first rule still counted it (ledger row 103). Every derived-edge insert in the engine goes through here.

A binary search of the base row and a tombstone lookup, not a merge of the row: building the merged row for each insert made re-deriving a hub’s out-edges after a snapshot quadratic in its degree.

Source

pub fn remove_edge(&mut self, etype: u32, src: u32, dst: u32)

Remove a derived edge, recording a tombstone only when the snapshot holds the edge.

Topology::remove_edge tombstones any edge the overlay lacks. A retraction can name an edge the graph holds nowhere — a store in which 0.8.0 had already lost an edge one rule still owned — and a tombstone over it is counted as a removed snapshot edge, so the edge count read one low per such retraction until the next snapshot (ledger row 109). Every derived-edge removal in the engine goes through here.

Source

pub fn neighbors(&self, etype: u32, dir: Direction, v: u32) -> Cow<'_, [u32]>

Neighbours of v over (etype, dir), merging the snapshot base with the post-snapshot overlay and subtracting the overlay’s tombstones.

A rule that reads the graph’s shape — today only a via-hop rule, when it expands its hop — must use this rather than topo directly. Reading the overlay alone on a store opened from a snapshot returns nothing, which a via-hop rule cannot distinguish from “this source reaches no via node” and answers by retracting every edge it owns.

Auto Trait Implementations§

§

impl<'a> !UnwindSafe for GraphMut<'a>

§

impl<'a> Freeze for GraphMut<'a>

§

impl<'a> RefUnwindSafe for GraphMut<'a>

§

impl<'a> Send for GraphMut<'a>

§

impl<'a> Sync for GraphMut<'a>

§

impl<'a> Unpin for GraphMut<'a>

§

impl<'a> UnsafeUnpin for GraphMut<'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> ArchivePointee for T

Source§

type ArchivedMetadata = ()

The archived version of the pointer metadata for this type.
Source§

fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata

Converts some archived metadata to the pointer metadata for itself.
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<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> LayoutRaw for T

Source§

fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>

Returns the layout of the type.
Source§

impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
where T: SharedNiching<N1, N2>, N1: Niching<T>, N2: Niching<T>,

Source§

unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool

Returns whether the given value has been niched. Read more
Source§

fn resolve_niched(out: Place<NichedOption<T, N1>>)

Writes data to out indicating that a T is niched.
Source§

impl<T> Pointee for T

Source§

type Metadata = ()

The metadata type for pointers and references to this type.
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.