LinkNetwork

Struct LinkNetwork 

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

A network of links representing interconnected structures.

In Links Theory, this replaces the traditional graph concept with a unified link-based model where vertices and edges are both represented as links.

Implementations§

Source§

impl LinkNetwork

Source

pub fn new() -> Self

Creates a new empty link network.

Source

pub fn from_notation(notation: &str) -> Self

Creates a link network from Links Notation string.

Parses simple triplet notation where each line represents a link: source relationship target

§Arguments
  • notation - Links Notation string describing the network
§Returns

A new LinkNetwork parsed from the notation

§Example
use network_isomorphism_solver::LinkNetwork;

let network = LinkNetwork::from_notation("
    A connects B
    B connects C
    C connects A
");
assert_eq!(network.node_count(), 3);
assert_eq!(network.link_count(), 3);
Source

pub fn from_lino(lino: &str) -> Result<Self, ParseError>

Creates a link network from Links Notation (LiNo) string using the links-notation crate parser.

This method parses proper LiNo format: (source target) doublets. For nested structures, it extracts the top-level doublets.

§Arguments
  • lino - Links Notation string in LiNo format
§Returns

Ok(LinkNetwork) if parsing succeeds, Err(ParseError) otherwise

§Example
use network_isomorphism_solver::LinkNetwork;

// Parse LiNo doublet format
let network = LinkNetwork::from_lino("(1 2) (2 3) (3 1)").unwrap();
assert_eq!(network.node_count(), 3);
assert_eq!(network.link_count(), 3);

// Parse named links
let network2 = LinkNetwork::from_lino("(link1: A B) (link2: B C)").unwrap();
assert_eq!(network2.node_count(), 3);
assert_eq!(network2.link_count(), 2);
§Errors

Returns ParseError if the LiNo string cannot be parsed

Adds a doublet-link to the network.

§Arguments
  • source - The source link reference
  • target - The target link reference
Source

pub fn node_count(&self) -> usize

Returns the number of nodes (unique link references) in the network.

Returns the number of links in the network.

Source

pub fn nodes(&self) -> &HashSet<LinkId>

Returns all nodes in the network.

Returns all links in the network.

Source

pub fn degree(&self, node: LinkId) -> usize

Returns the degree (number of connections) of a node.

Source

pub fn neighbors(&self, node: LinkId) -> Option<&HashSet<LinkId>>

Returns the neighbors of a node.

Source

pub fn degree_sequence(&self) -> Vec<usize>

Computes the degree sequence of the network (sorted list of degrees).

Trait Implementations§

Source§

impl Clone for LinkNetwork

Source§

fn clone(&self) -> LinkNetwork

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 LinkNetwork

Source§

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

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

impl Default for LinkNetwork

Source§

fn default() -> LinkNetwork

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

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.