Candidate_v1.6.1
ChemicalSpaceEvaluator
Last change
on this file since f5ea10 was f5ea10, checked in by Frederik Heber <frederik.heber@…>, 7 years ago |
Added Graph6Reader, extended BoostGraphCreator, added ChemicalSpaceEvaluatorAction.
- added visible generateAllInducedSubgraphs to Extractors.
- TESTS: due to new option "graph6" containing a digit we needed to modify
moltest_check.py to also scan for digits and not just letters.
- DOCU: Added evaluate-chemical-space to userguide.
|
-
Property mode
set to
100644
|
File size:
1.5 KB
|
Rev | Line | |
---|
[f5ea10] | 1 | /*
|
---|
| 2 | * Graph6Reader.hpp
|
---|
| 3 | *
|
---|
| 4 | * Created on: Sep 26, 2017
|
---|
| 5 | * Author: heber
|
---|
| 6 | */
|
---|
| 7 |
|
---|
| 8 |
|
---|
| 9 | #ifndef GRAPH_GRAPH6READER_HPP_
|
---|
| 10 | #define GRAPH_GRAPH6READER_HPP_
|
---|
| 11 |
|
---|
| 12 | // include config.h
|
---|
| 13 | #ifdef HAVE_CONFIG_H
|
---|
| 14 | #include <config.h>
|
---|
| 15 | #endif
|
---|
| 16 |
|
---|
| 17 | #include <istream>
|
---|
| 18 | #include <string>
|
---|
| 19 | #include <vector>
|
---|
| 20 |
|
---|
| 21 | /** This functor parses graph6 formatted strings and returns number of nodes
|
---|
| 22 | * and a edge list.
|
---|
| 23 | *
|
---|
| 24 | * This is inspired by https://github.com/adrianN/graph6/, only I found the code
|
---|
| 25 | * there quite ugly and unnecessarily complicated: inheriting from std::iterator,
|
---|
| 26 | * overriding all the operators (++, *, ...) for no apparent reason instead of
|
---|
| 27 | * adding normal functions, ...
|
---|
| 28 | *
|
---|
| 29 | */
|
---|
| 30 | struct Graph6Reader
|
---|
| 31 | {
|
---|
| 32 | typedef std::pair<int, int> edge_t;
|
---|
| 33 | typedef std::vector< edge_t > edges_t;
|
---|
| 34 |
|
---|
| 35 | Graph6Reader() :
|
---|
| 36 | column(0),
|
---|
| 37 | row(0),
|
---|
| 38 | eos(0),
|
---|
| 39 | bit_pos(0),
|
---|
| 40 | cur_byte(0),
|
---|
| 41 | num_nodes(0)
|
---|
| 42 | {}
|
---|
| 43 |
|
---|
| 44 | void operator()(std::istream &_graph_string);
|
---|
| 45 |
|
---|
| 46 | int get_num_nodes() const
|
---|
| 47 | { return num_nodes; }
|
---|
| 48 |
|
---|
| 49 | const edges_t& get_edges() const
|
---|
| 50 | { return edges; }
|
---|
| 51 |
|
---|
| 52 | private:
|
---|
| 53 |
|
---|
| 54 | void scan_num_nodes(std::istream_iterator<unsigned char> &_it);
|
---|
| 55 | void scan_edges(std::istream_iterator<unsigned char> &_it);
|
---|
| 56 | void next_edge(std::istream_iterator<unsigned char> &_it);
|
---|
| 57 |
|
---|
| 58 | private:
|
---|
| 59 | int column;
|
---|
| 60 | int row;
|
---|
| 61 | int eos;
|
---|
| 62 | int bit_pos;
|
---|
| 63 | int cur_byte;
|
---|
| 64 | static const int packet_size;
|
---|
| 65 |
|
---|
| 66 | //!> contains number of edges
|
---|
| 67 | int num_nodes;
|
---|
| 68 | //!> contains edge list
|
---|
| 69 | std::vector< edge_t > edges;
|
---|
| 70 | };
|
---|
| 71 |
|
---|
| 72 |
|
---|
| 73 | #endif /* GRAPH_GRAPH6READER_HPP_ */
|
---|
Note:
See
TracBrowser
for help on using the repository browser.