Struct fast_paths::InputGraph
source · pub struct InputGraph { /* private fields */ }
Implementations§
source§impl InputGraph
impl InputGraph
pub fn new() -> Self
sourcepub fn from_file(filename: &str) -> Self
pub fn from_file(filename: &str) -> Self
Reads an input graph from a text file, using the following format:
a
sourcepub fn to_file(&self, filename: &str) -> Result<(), Error>
pub fn to_file(&self, filename: &str) -> Result<(), Error>
Writes the input graph to a text file, using the following format:
a
sourcepub fn from_dimacs_file(filename: &str) -> Self
pub fn from_dimacs_file(filename: &str) -> Self
Reads an input graph from a text file, using the DIMACS format: http://users.diag.uniroma1.it/challenge9/format.shtml#graph
- empty lines and lines starting with ‘c’ are ignored:
c
- the ‘problem line’ states the number of nodes and edges of the graph: it must be written before any arc line p <num_nodes> <num_edges>
- there is one line per (directed) edge:
a
where and must be >= 1 and must be >= 0 Note that here, in contrast to InputGraph::from_file, the node IDs are 1-based, not 0-based. They will be converted to 0-based IDs internally.
Mostly used for performance testing.
sourcepub fn to_dimacs_file(&self, filename: &str) -> Result<(), Error>
pub fn to_dimacs_file(&self, filename: &str) -> Result<(), Error>
Writes the input graph to a text file, using the DIMACS format:
p sp <num_nodes> <num_edges>
a
pub fn add_edge(&mut self, from: NodeId, to: NodeId, weight: Weight) -> usize
pub fn add_edge_bidir( &mut self, from: NodeId, to: NodeId, weight: Weight ) -> usize
pub fn get_edges(&self) -> &Vec<Edge>
pub fn get_num_nodes(&self) -> usize
pub fn get_num_edges(&self) -> usize
pub fn freeze(&mut self)
pub fn thaw(&mut self)
pub fn unit_test_output_string(&self) -> String
Trait Implementations§
source§impl Clone for InputGraph
impl Clone for InputGraph
source§fn clone(&self) -> InputGraph
fn clone(&self) -> InputGraph
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more