pub struct DiGraph {
pub bit_vec: Vec<usize>,
pub n: usize,
}
Expand description
Creates a directed graph from a graph6 representation
Fields§
§bit_vec: Vec<usize>
§n: usize
Implementations§
Source§impl DiGraph
impl DiGraph
Sourcepub fn from_d6(repr: &str) -> Result<Self, IOError>
pub fn from_d6(repr: &str) -> Result<Self, IOError>
Creates a new DiGraph from a graph6 representation string
§Arguments
repr
- A graph6 representation string
§Errors
Returns an error if the graph6 representation is invalid (i.e. missing digraph header ‘&’)
§Examples
use graph6_rs::DiGraph;
let graph = DiGraph::from_d6("&AG").unwrap();
assert_eq!(graph.n, 2);
assert_eq!(graph.bit_vec, &[0, 0, 1, 0]);
Sourcepub fn from_adj(adj: &[usize]) -> Result<Self, IOError>
pub fn from_adj(adj: &[usize]) -> Result<Self, IOError>
Creates a new DiGraph from a flattened adjacency matrix
§Arguments
adj
- A flattened adjacency matrix
§Errors
Returns an error if the adjacency matrix is invalid (i.e. not square)
§Examples
use graph6_rs::DiGraph;
let graph = DiGraph::from_adj(&[0, 0, 1, 0]).unwrap();
assert_eq!(graph.n, 2);
assert_eq!(graph.bit_vec, &[0, 0, 1, 0]);
Trait Implementations§
Source§impl GraphConversion for DiGraph
impl GraphConversion for DiGraph
Source§impl WriteGraph for DiGraph
impl WriteGraph for DiGraph
fn write_graph(&self) -> String
Auto Trait Implementations§
impl Freeze for DiGraph
impl RefUnwindSafe for DiGraph
impl Send for DiGraph
impl Sync for DiGraph
impl Unpin for DiGraph
impl UnwindSafe for DiGraph
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more