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
impl LinkNetwork
Sourcepub fn from_notation(notation: &str) -> Self
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);Sourcepub fn from_lino(lino: &str) -> Result<Self, ParseError>
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 inLiNoformat
§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
Sourcepub fn add_link(&mut self, source: LinkId, target: LinkId)
pub fn add_link(&mut self, source: LinkId, target: LinkId)
Adds a doublet-link to the network.
§Arguments
source- The source link referencetarget- The target link reference
Sourcepub fn node_count(&self) -> usize
pub fn node_count(&self) -> usize
Returns the number of nodes (unique link references) in the network.
Sourcepub fn link_count(&self) -> usize
pub fn link_count(&self) -> usize
Returns the number of links in the network.
Sourcepub fn links(&self) -> &[DoubletLink]
pub fn links(&self) -> &[DoubletLink]
Returns all links in the network.
Sourcepub fn degree(&self, node: LinkId) -> usize
pub fn degree(&self, node: LinkId) -> usize
Returns the degree (number of connections) of a node.
Sourcepub fn neighbors(&self, node: LinkId) -> Option<&HashSet<LinkId>>
pub fn neighbors(&self, node: LinkId) -> Option<&HashSet<LinkId>>
Returns the neighbors of a node.
Sourcepub fn degree_sequence(&self) -> Vec<usize>
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
impl Clone for LinkNetwork
Source§fn clone(&self) -> LinkNetwork
fn clone(&self) -> LinkNetwork
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more