This repository was archived by the owner on May 27, 2019. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -18,10 +18,6 @@ std::string DirectedGraph::getAvailableAlgorithms() {
1818 return output;
1919}
2020
21- void DirectedGraph::loadDataFrom (std::string fileName) {
22- vector<int > rawData = loadRawDataFrom (fileName);
23- }
24-
2521void DirectedGraph::generate (int numberOfVertices, int density) {
2622
2723}
@@ -33,3 +29,13 @@ void DirectedGraph::runAlgorithm(int index) {
3329void DirectedGraph::test () {
3430
3531}
32+
33+ // private
34+
35+ void DirectedGraph::loadRawDataToMatrix (std::vector<int > rawData) {
36+
37+ }
38+
39+ void DirectedGraph::loadRawDataToList (std::vector<int > rawData) {
40+
41+ }
Original file line number Diff line number Diff line change @@ -14,14 +14,16 @@ class DirectedGraph : public Graph {
1414
1515 std::string getAvailableAlgorithms () override ;
1616
17- void loadDataFrom (std::string fileName) override ;
18-
1917 void generate (int numberOfVertices, int density) override ;
2018
2119 void runAlgorithm (int index) override ;
2220
2321 void test () override ;
2422
23+ protected:
24+ void loadRawDataToMatrix (std::vector<int > rawData) override ;
25+ void loadRawDataToList (std::vector<int > rawData) override ;
26+
2527};
2628
2729
Original file line number Diff line number Diff line change @@ -112,6 +112,12 @@ string Graph::printAdjacencyList() {
112112 return output;
113113}
114114
115+ void Graph::loadDataFrom (std::string fileName) {
116+ vector<int > rawData = loadRawDataFrom (fileName);
117+ loadRawDataToMatrix (rawData);
118+ loadRawDataToList (rawData);
119+ }
120+
115121// protected
116122
117123vector<int > Graph::loadRawDataFrom (string path) {
Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ class Graph {
4141
4242 std::string printAdjacencyList ();
4343
44- virtual void loadDataFrom (std::string fileName)= 0 ;
44+ void loadDataFrom (std::string fileName);
4545
4646 virtual void generate (int numberOfVertices, int density)= 0;
4747
@@ -53,6 +53,9 @@ class Graph {
5353
5454 std::vector<int > loadRawDataFrom (std::string path);
5555
56+ virtual void loadRawDataToMatrix (std::vector<int > rawData)= 0;
57+ virtual void loadRawDataToList (std::vector<int > rawData)= 0;
58+
5659};
5760
5861
Original file line number Diff line number Diff line change @@ -18,10 +18,6 @@ std::string UndirectedGraph::getAvailableAlgorithms() {
1818 return output;
1919}
2020
21- void UndirectedGraph::loadDataFrom (std::string fileName) {
22- vector<int > rawData = loadRawDataFrom (fileName);
23- }
24-
2521void UndirectedGraph::generate (int numberOfVertices, int density) {
2622
2723}
@@ -33,3 +29,13 @@ void UndirectedGraph::runAlgorithm(int index) {
3329void UndirectedGraph::test () {
3430
3531}
32+
33+ // private
34+
35+ void UndirectedGraph::loadRawDataToMatrix (vector<int > rawData) {
36+
37+ }
38+
39+ void UndirectedGraph::loadRawDataToList (std::vector<int > rawData) {
40+
41+ }
Original file line number Diff line number Diff line change @@ -14,14 +14,16 @@ class UndirectedGraph : public Graph {
1414
1515 std::string getAvailableAlgorithms () override ;
1616
17- void loadDataFrom (std::string fileName) override ;
18-
1917 void generate (int numberOfVertices, int density) override ;
2018
2119 void runAlgorithm (int index) override ;
2220
2321 void test () override ;
2422
23+ protected:
24+ void loadRawDataToMatrix (std::vector<int > rawData) override ;
25+ void loadRawDataToList (std::vector<int > rawData) override ;
26+
2527};
2628
2729
You can’t perform that action at this time.
0 commit comments