Ignore:
Timestamp:
Apr 23, 2021, 8:51:43 PM (5 years ago)
Author:
Frederik Heber <frederik.heber@…>
Branches:
Candidate_v1.7.0, stable
Children:
9171d8
Parents:
d951a5
git-author:
Frederik Heber <frederik.heber@…> (03/27/21 16:54:08)
git-committer:
Frederik Heber <frederik.heber@…> (04/23/21 20:51:43)
Message:

FIX: Several small errors in Graph6Reader.

  • off-by-one error with encoding starts at 63 (0), not 64.
  • cur_byte needs to exist outside of scope of next_edge().
  • need a mapping from edges_by_vertices in the subgraph (with indices from the subgraph vertices) to the edge index used in th degrees array to properly calculate the bond degrees.
  • TESTS: Added a chemical space evaluator test case with 3 nodes.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Graph/Graph6Reader.cpp

    rd951a5 r1be100  
    5757        if (*_it <126) {
    5858                //6-bit encoding
    59                 num_nodes = *_it-64;
     59                num_nodes = *_it-63;
    6060        } else if (*_it++ == 126) {
    6161                unsigned int packets = 3;
     
    6666                }
    6767                for(unsigned int i =0; i<packets*packet_size; ++i) {
    68                         unsigned char packet = (*_it++) - 64;
     68                        unsigned char packet = (*_it++) - 63;
    6969                        ASSERT(packet<=(1<<(packet_size+1)),
    7070                                        "The input is malformed. "
     
    8484void Graph6Reader::next_edge(std::istream_iterator<unsigned char> &_it) {
    8585  unsigned int bit = 0;
    86   int cur_byte = 0;
    8786  while(!bit && !eos) {
    8887    if (++row==column) {
     
    9594    }
    9695    if (bit_pos<0) {
    97       ASSERT((*_it >= 63) && (*_it <= 126),
     96      ASSERT(_it != std::istream_iterator<unsigned char>(),
     97          "Graph6Reader::next_edge() - less characters than expected in string.");
     98      ASSERT((*_it >= 64) && (*_it <= 126),
    9899          "The input contains a non-printable ascii char in the matrix encoding");
    99100      cur_byte = (*_it) - 63;
Note: See TracChangeset for help on using the changeset viewer.