Candidate_v1.7.0
        stable
      
      
        
          | Last change
 on this file since 894040 was             1c0b0b, checked in by Frederik Heber <frederik.heber@…>, 3 years ago | 
        
          | 
Graph6Writer::write_elementlist uses BFS from boundary atom.
 the elementlist is not stable as the set of atoms is arbitrary to any
kind of permutation. However, the underlying bond graph is not, even
though it may also have some symmetries.
Therefore, we use a BFS from a non-hydrogen atom on the boundary.
FIX: BoosGraphCreator gets vector of const atom*.
 | 
        
          | 
              
Property                 mode
 set to                 100644 | 
        
          | File size:
            1.1 KB | 
      
      
| Line |  | 
|---|
| 1 | /* | 
|---|
| 2 | * Graph6Writer.hpp | 
|---|
| 3 | * | 
|---|
| 4 | *  Created on: Apr 2, 2021 | 
|---|
| 5 | *      Author: heber | 
|---|
| 6 | */ | 
|---|
| 7 |  | 
|---|
| 8 |  | 
|---|
| 9 | #ifndef GRAPH_GRAPH6WRITER_HPP_ | 
|---|
| 10 | #define GRAPH_GRAPH6WRITER_HPP_ | 
|---|
| 11 |  | 
|---|
| 12 | // include config.h | 
|---|
| 13 | #ifdef HAVE_CONFIG_H | 
|---|
| 14 | #include <config.h> | 
|---|
| 15 | #endif | 
|---|
| 16 |  | 
|---|
| 17 | #include <iosfwd> | 
|---|
| 18 | #include <vector> | 
|---|
| 19 |  | 
|---|
| 20 | #include "types.hpp" | 
|---|
| 21 |  | 
|---|
| 22 | class atom; | 
|---|
| 23 |  | 
|---|
| 24 | /** This functor prints a set of atoms as a graph6 formatted strings and returns | 
|---|
| 25 | * all elements as a vector in the same order as the nodes in the graph6 | 
|---|
| 26 | * representation. | 
|---|
| 27 | * | 
|---|
| 28 | * This is inspired by https://github.com/adrianN/graph6/, only I found the code | 
|---|
| 29 | * there quite ugly and unnecessarily complicated: inheriting from std::iterator, | 
|---|
| 30 | * overriding all the operators (++, *, ...) for no apparent reason instead of | 
|---|
| 31 | * adding normal functions, ... | 
|---|
| 32 | * | 
|---|
| 33 | */ | 
|---|
| 34 | struct Graph6Writer | 
|---|
| 35 | { | 
|---|
| 36 | const std::vector<const atom *> _atoms; | 
|---|
| 37 |  | 
|---|
| 38 | Graph6Writer(const std::vector<const atom *> atoms); | 
|---|
| 39 |  | 
|---|
| 40 | void write_n(std::ostream& out); | 
|---|
| 41 |  | 
|---|
| 42 | void write_graph6(std::ostream& out); | 
|---|
| 43 |  | 
|---|
| 44 | void write_elementlist(std::ostream& out); | 
|---|
| 45 |  | 
|---|
| 46 | private: | 
|---|
| 47 | atomId_t getBoundaryNonHydrogen() const; | 
|---|
| 48 | }; | 
|---|
| 49 |  | 
|---|
| 50 |  | 
|---|
| 51 | #endif /* GRAPH_GRAPH6WRITER_HPP_ */ | 
|---|
       
      
  Note:
 See   
TracBrowser
 for help on using the repository browser.