Skip to content

Commit

Permalink
turned read_from_file fn to new fn
Browse files Browse the repository at this point in the history
  • Loading branch information
VuQuangPhuc committed Oct 27, 2019
1 parent d1e8543 commit b212c53
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
7 changes: 7 additions & 0 deletions .idea/dictionaries/vu.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/graph/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ pub mod ugraph;

pub fn create_undirected_graph(file: File) -> UndirectedGraph {
let now = Instant::now();
let graph: UndirectedGraph = Graph::read_from_file(&file);
let graph: UndirectedGraph = Graph::new(&file);
println!("{}", now.elapsed().as_micros());

graph
}

pub trait Graph {
fn read_from_file(file: &File) -> Self;
fn new(file: &File) -> Self;
fn find_strong_connected_components(&self) -> ();
}

Expand Down
2 changes: 1 addition & 1 deletion src/graph/ugraph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ impl UndirectedGraph {
}

impl Graph for UndirectedGraph {
fn read_from_file(file: &File) -> UndirectedGraph {
fn new(file: &File) -> UndirectedGraph {
let reader = BufReader::new(file);

let mut graph: UndirectedGraph = UndirectedGraph {
Expand Down

0 comments on commit b212c53

Please sign in to comment.