write_problem

Function write_problem 

Source
pub fn write_problem<T: Serialize, P: AsRef<Path>>(
    problem: &T,
    path: P,
    format: FileFormat,
) -> Result<()>
Expand description

Write a problem to a file.

§Arguments

  • problem - The problem to write
  • path - The file path to write to
  • format - The file format to use

§Example

use problemreductions::io::{write_problem, FileFormat};
use problemreductions::models::graph::IndependentSet;

let problem = IndependentSet::<i32>::new(3, vec![(0, 1), (1, 2)]);
write_problem(&problem, "problem.json", FileFormat::Json).unwrap();