TeloidGraph

Struct TeloidGraph 

Source
pub struct TeloidGraph { /* private fields */ }
Expand description

A graph structure representing the relationships between Teloids (norms).

This struct wraps UltraGraphWeighted, storing only TeloidIDs in the nodes for memory efficiency. The edges are weighted with TeloidRelation to represent inheritance or defeasance between norms.

For more details, see section 5 (Causality as EPP) and 8 (Teleology) in The EPP reference paper: https://github.com/deepcausality-rs/papers/blob/main/effect_propagation_process/epp.pdf

Implementations§

Source§

impl TeloidGraph

Source

pub fn number_nodes(&self) -> usize

Source

pub fn number_edges(&self) -> usize

Source

pub fn contains_edge(&self, a: usize, b: usize) -> bool

Source

pub fn is_empty(&self) -> bool

Source

pub fn clear(&mut self) -> Result<(), DeonticError>

Source§

impl TeloidGraph

Source

pub fn is_frozen(&self) -> bool

Source

pub fn freeze(&mut self)

Source

pub fn unfreeze(&mut self)

Source§

impl TeloidGraph

Source

pub fn new() -> Self

Creates a new, empty TeloidGraph.

§Returns

A new TeloidGraph instance with an empty internal graph.

Source

pub fn with_capacity(capacity: usize) -> Self

Creates a new TeloidGraph with a pre-allocated capacity for its internal graph.

This can be useful for performance optimization when the approximate number of nodes (Teloids) is known in advance, reducing the need for reallocations.

§Arguments
  • capacity - The initial capacity for the internal graph’s storage.
§Returns

A new TeloidGraph instance with the specified capacity.

Trait Implementations§

Source§

impl Clone for TeloidGraph

Source§

fn clone(&self) -> TeloidGraph

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TeloidGraph

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for TeloidGraph

Source§

fn default() -> TeloidGraph

Returns the “default value” for a type. Read more
Source§

impl Teloidable for TeloidGraph

Source§

fn add_teloid(&mut self, id: TeloidID) -> Result<usize, DeonticError>

Adds a new teloid (node) to the graph.

§Arguments
  • id - The TeloidID of the teloid to add.
§Returns

A Result which is Ok(usize) containing the index of the newly added teloid, or Err(GraphError) if the operation fails.

Source§

fn get_teloid_id(&self, index: usize) -> Option<TeloidID>

Retrieves the TeloidID associated with a given node index.

§Arguments
  • index - The index of the teloid (node) to retrieve the ID for.
§Returns

An Option<TeloidID> which is Some(TeloidID) if the teloid exists at the given index, or None otherwise.

Source§

fn contains_teloid(&self, index: usize) -> bool

Checks if a teloid (node) exists at the given index in the graph.

§Arguments
  • index - The index to check for the presence of a teloid.
§Returns

true if a teloid exists at the specified index, false otherwise.

Source§

fn add_inheritance_edge( &mut self, parent_idx: usize, child_idx: usize, ) -> Result<(), DeonticError>

Adds an inheritance edge between a parent teloid and a child teloid.

§Arguments
  • parent_idx - The index of the parent teloid.
  • child_idx - The index of the child teloid.
§Returns

A Result which is Ok(()) if the edge was added successfully, or Err(GraphError) if the operation fails.

Source§

fn add_defeasance_edge( &mut self, defeater_idx: usize, defeated_idx: usize, ) -> Result<(), DeonticError>

Adds a defeasance edge between a defeater teloid and a defeated teloid.

§Arguments
  • defeater_idx - The index of the defeater teloid.
  • defeated_idx - The index of the defeated teloid.
§Returns

A Result which is Ok(()) if the edge was added successfully, or Err(GraphError) if the operation fails.

Auto Trait Implementations§

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<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.