Struct fast_paths::InputGraph

source ·
pub struct InputGraph { /* private fields */ }

Implementations§

source§

impl InputGraph

source

pub fn new() -> Self

source

pub fn from_file(filename: &str) -> Self

Reads an input graph from a text file, using the following format: a where , and must be >= 0. All other lines are ignored. This function is compatible to DIMACS files, but consider using InputGraph::from_dimacs for these instead. Mostly used for performance testing.

source

pub fn to_file(&self, filename: &str) -> Result<(), Error>

Writes the input graph to a text file, using the following format: a Mostly used for performance testing.

source

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.

source

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 Note that and are 1-based, so they are incremented by one compared to the node IDs used by internally. Mostly used for performance testing.

source

pub fn add_edge(&mut self, from: NodeId, to: NodeId, weight: Weight) -> usize

source

pub fn add_edge_bidir( &mut self, from: NodeId, to: NodeId, weight: Weight ) -> usize

source

pub fn get_edges(&self) -> &Vec<Edge>

source

pub fn get_num_nodes(&self) -> usize

source

pub fn get_num_edges(&self) -> usize

source

pub fn freeze(&mut self)

source

pub fn thaw(&mut self)

source

pub fn unit_test_output_string(&self) -> String

Trait Implementations§

source§

impl Clone for InputGraph

source§

fn clone(&self) -> InputGraph

Returns a copy 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 InputGraph

source§

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

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

impl Default for InputGraph

source§

fn default() -> Self

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

impl<'de> Deserialize<'de> for InputGraph

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Serialize for InputGraph

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. 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> 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,

§

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>,

§

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>,

§

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.
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,