Start to implement assignment 4

This commit is contained in:
2020-11-27 15:23:14 -05:00
parent f76f570d8b
commit 47e5fec4bd
3 changed files with 27 additions and 1 deletions

View File

@@ -3,6 +3,14 @@ use std::io;
use std::io::{BufRead, BufReader, Error, ErrorKind};
use std::vec::Vec;
#[derive(Debug)]
pub struct Graph {
nodes: Vec<u32>,
edges: Vec<(u32, u32)>,
}
pub fn read_to_vector(path: &str) -> Result<Vec<i64>, io::Error> {
let file = File::open(path)?;
let br = BufReader::new(file);
@@ -19,3 +27,15 @@ pub fn read_to_vector(path: &str) -> Result<Vec<i64>, io::Error> {
}
pub fn read_to_graph(path: &str) -> Result<Graph, io::Error> {
let mut g = Graph { nodes: vec![], edges: vec![] };
let file = File::open(path)?;
let br = BufReader::new(file);
for line in br.lines() {
let line = line?;
println!("{:?}", line);
}
Ok(g)
}