Changeset 99c705 for src/Graph


Ignore:
Timestamp:
Jun 22, 2018, 7:26:30 AM (7 years ago)
Author:
Frederik Heber <frederik.heber@…>
Branches:
Candidate_v1.6.1, ChemicalSpaceEvaluator
Children:
d661b2
Parents:
f5ea10
git-author:
Frederik Heber <frederik.heber@…> (10/01/17 11:02:10)
git-committer:
Frederik Heber <frederik.heber@…> (06/22/18 07:26:30)
Message:

ChemicalSpaceEvaluator working for graph with 2 nodes.

Location:
src/Graph
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/Graph/BoostGraphCreator.cpp

    rf5ea10 r99c705  
    118118    atomids_nodeids.insert( std::make_pair(vertexname, vertexindex) );
    119119  }
     120  LOG(1, "INFO: Added " << reader.get_num_nodes() << " nodes.");
    120121
    121122  // add edges
     
    128129    boost::add_edge(leftnodeid, rightnodeid, graph);
    129130  }
     131  LOG(1, "INFO: Added " << reader.get_edges().size() << " edges.");
    130132}
    131133
  • src/Graph/Graph6Reader.cpp

    rf5ea10 r99c705  
    3636//#include "CodePatterns/MemDebug.hpp"
    3737
    38 #include <iterator>
    39 
    4038#include "CodePatterns/Assert.hpp"
     39#include "CodePatterns/Log.hpp"
    4140
    4241#include "Graph6Reader.hpp"
     
    5352void Graph6Reader::scan_num_nodes(std::istream_iterator<unsigned char> &_it)
    5453{
    55   int packets;
    56   int num_nodes;
    5754        //now we're one past the optional header
    5855        //parse the number of nodes
    59         ASSERT(*_it >= 63, "The number of nodes is not properly encoded");
     56        ASSERT(*_it >= 64, "The number of nodes is not properly encoded");
    6057        if (*_it <126) {
    6158                //6-bit encoding
    62                 num_nodes = *_it-63;
     59                num_nodes = *_it-64;
    6360        } else if (*_it++ == 126) {
    6461                unsigned int packets = 3;
     
    6966                }
    7067                for(unsigned int i =0; i<packets*packet_size; ++i) {
    71                         unsigned char packet = (*_it++) - 63;
     68                        unsigned char packet = (*_it++) - 64;
    7269                        ASSERT(packet<=(1<<(packet_size+1)),
    7370                                        "The input is malformed. "
     
    8784void Graph6Reader::next_edge(std::istream_iterator<unsigned char> &_it) {
    8885  unsigned int bit = 0;
     86  int cur_byte = 0;
    8987  while(!bit && !eos) {
    9088    if (++row==column) {
     
    112110  while(!eos) {
    113111    next_edge(_it);
    114     edges.push_back(std::make_pair(column,row));
     112    if (!eos) {
     113      LOG(3, "DEBUG: Adding edge bit in (" << column << "," << row << ")");
     114      edges.push_back(std::make_pair(column,row));
     115    }
    115116  }
    116117}
  • src/Graph/Graph6Reader.hpp

    rf5ea10 r99c705  
    1616
    1717#include <istream>
     18#include <iterator>
    1819#include <string>
    1920#include <vector>
     
    3435
    3536  Graph6Reader() :
    36     column(0),
    37     row(0),
    38     eos(0),
    39     bit_pos(0),
    40     cur_byte(0),
     37    column(1),
     38    row(-1),
     39    eos(false),
     40    bit_pos(-1),
    4141    num_nodes(0)
    4242  {}
     
    5959  int column;
    6060  int row;
    61   int eos;
     61  bool eos;
    6262  int bit_pos;
    63   int cur_byte;
    6463  static const int packet_size;
    6564
Note: See TracChangeset for help on using the changeset viewer.