Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Fragmentation/Graph.cpp

    r94d5ac6 rb4f72c  
    6464 * \param *counter keyset counter that gets increased
    6565 */
    66 void Graph::InsertGraph(Graph &graph, int *counter)
     66void Graph::InsertGraph(const Graph &graph, int &counter)
    6767{
    6868  GraphTestPair testGraphInsert;
    6969
    70   for(Graph::iterator runner = graph.begin(); runner != graph.end(); runner++) {
    71     testGraphInsert = insert(GraphPair ((*runner).first,pair<int,double>((*counter)++,((*runner).second).second)));  // store fragment number and current factor
     70  for(Graph::const_iterator runner = graph.begin(); runner != graph.end(); runner++) {
     71    testGraphInsert = insert(GraphPair ((*runner).first,pair<int,double>(++counter,((*runner).second).second)));  // store fragment number and current factor
    7272    if (testGraphInsert.second) {
    73       LOG(2, "INFO: KeySet " << (*counter)-1 << " successfully inserted.");
     73      LOG(2, "INFO: KeySet " << counter-1 << " successfully inserted.");
    7474    } else {
    75       LOG(2, "INFO: KeySet " << (*counter)-1 << " failed to insert, present fragment is " << ((*(testGraphInsert.first)).second).first);
     75      LOG(2, "INFO: KeySet " << counter-1 << " failed to insert, present fragment is " << ((*(testGraphInsert.first)).second).first);
    7676      ((*(testGraphInsert.first)).second).second += (*runner).second.second;
    7777      LOG(2, "INFO: New factor is " << (*(testGraphInsert.first)).second.second << ".");
     
    132132 * \return true - file written successfully, false - writing failed
    133133 */
    134 bool Graph::StoreKeySetFile(std::string &path)
     134bool Graph::StoreKeySetFile(std::string &path) const
    135135{
    136136  bool status =  true;
     
    141141  LOG(1, "INFO: Saving key sets of the total graph ... ");
    142142  if(output.good()) {
    143     for(Graph::iterator runner = begin(); runner != end(); runner++) {
    144       for (KeySet::iterator sprinter = (*runner).first.begin();sprinter != (*runner).first.end(); sprinter++) {
     143    for(Graph::const_iterator runner = begin(); runner != end(); runner++) {
     144      for (KeySet::const_iterator sprinter = (*runner).first.begin();sprinter != (*runner).first.end(); sprinter++) {
    145145        if (sprinter != (*runner).first.begin())
    146146          output << "\t";
     
    156156  }
    157157  output.close();
    158   output.clear();
    159158
    160159  return status;
     
    210209 * \return true - file written successfully, false - writing failed
    211210 */
    212 bool Graph::StoreTEFactorsFile(char *path)
     211bool Graph::StoreTEFactorsFile(char *path) const
    213212{
    214213  ofstream output;
     
    224223  LOG(1, "INFO: Saving TEFactors of the total graph ... ");
    225224  if(output != NULL) {
    226     for(Graph::iterator runner = begin(); runner != end(); runner++)
     225    for(Graph::const_iterator runner = begin(); runner != end(); runner++)
    227226      output << (*runner).second.second << endl;
    228227    LOG(1, "INFO: done." << endl);
Note: See TracChangeset for help on using the changeset viewer.