[−][src]Function graph6::string_to_adjacency_matrix
pub fn string_to_adjacency_matrix(graph_str: &str) -> (Vec<f32>, usize)
Converts a string in graph6 format to its adjacency matrix, and returns the matrix and the graph size.
The returned adjacency matrix is a vector with elements stored in row-major order. Note, this function only supports graphs with less than 63 vertices.
Panics
Panics if the graph has more than 62 vertices.
Example
let graph = String::from("BW"); let (adjacency_matrix, size) = graph6::string_to_adjacency_matrix(&graph); assert_eq!(adjacency_matrix, vec![0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 1.0, 1.0, 0.0]); assert_eq!(size, 3);