Browse Source

removed unnecessary code

main
Stefan Pranger 3 years ago
parent
commit
b3ba9fcfaa
  1. 14
      Graph.cpp
  2. 1
      Graph.h

14
Graph.cpp

@ -10,16 +10,10 @@
namespace data {
Graph::Graph(bool stdout_output, bool file_output, std::string output_filename, bool verbose_max_flow, bool min_cut, int verbosity)
: m_file_output(file_output), m_output_file_name(output_filename), m_verbose_max_flow(verbose_max_flow), m_min_cut(min_cut), m_verbosity(verbosity) {
//if(!stdout_output && file_output) {
// m_stdout_output = false;
//} else {
// m_stdout_output = true;
//}
}
void Graph::parseFromString(const std::string &graph_string) {
parser::parseString(graph_string, m_arc_list, m_vertices, m_source_id, m_sink_id, m_num_vertices, m_num_arcs);
setSourceAndSinkIterator();
initMatrices();
initOstream();
}
@ -29,7 +23,6 @@ namespace data {
throw std::runtime_error("Input graph file name and output file name are the same. Will not overwrite. Exiting...");
}
parser::parseFile(graph_file, m_arc_list, m_vertices, m_source_id, m_sink_id, m_num_vertices, m_num_arcs);
setSourceAndSinkIterator();
initMatrices();
initOstream();
}
@ -38,15 +31,10 @@ namespace data {
m_flow.resize(m_num_vertices, std::vector<Capacity>(m_num_vertices, 0));
m_capapcities.resize(m_num_vertices, std::vector<Capacity>(m_num_vertices, 0));
for(auto const &arc : m_arc_list) {
m_capapcities.at(arc.start - 1).at(arc.end - 1) = arc.capacity; // how to best map arbitrary ids to index in matrix
m_capapcities.at(arc.start - 1).at(arc.end - 1) = arc.capacity;
}
}
void Graph::setSourceAndSinkIterator() {
auto m_source = std::find_if(m_vertices.begin(), m_vertices.end(), [this] (const Vertex &v) { return (v.getID() == m_source_id); });
auto m_sink = std::find_if(m_vertices.begin(), m_vertices.end(), [this] (const Vertex &v) { return (v.getID() == m_sink_id); });
}
void Graph::initOstream() {
if(m_file_output) {
m_ofstream = new std::ofstream(m_output_file_name);

1
Graph.h

@ -26,7 +26,6 @@ namespace data {
private:
void initMatrices();
void setSourceAndSinkIterator();
void initOstream();
void constructLevelGraph();

Loading…
Cancel
Save