Changeset f5ea10 for src/FunctionApproximation/Extractors.hpp
- Timestamp:
- Jun 22, 2018, 7:26:09 AM (7 years ago)
- Branches:
- Candidate_v1.6.1, ChemicalSpaceEvaluator
- Children:
- 99c705
- Parents:
- 8d56a6
- git-author:
- Frederik Heber <frederik.heber@…> (09/26/17 22:30:01)
- git-committer:
- Frederik Heber <frederik.heber@…> (06/22/18 07:26:09)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/FunctionApproximation/Extractors.hpp
r8d56a6 rf5ea10 14 14 #endif 15 15 16 #include <boost/bimap.hpp> 17 #include <boost/bimap/set_of.hpp> 18 #include <boost/bimap/multiset_of.hpp> 19 #include <boost/graph/adjacency_list.hpp> 20 #include <boost/graph/breadth_first_search.hpp> 21 #include <boost/graph/subgraph.hpp> 16 22 #include <boost/function.hpp> 23 24 #include <map> 25 #include <set> 17 26 18 27 #include "Fragmentation/EdgesPerFragment.hpp" … … 51 60 typedef std::vector<ParticleType_t> ParticleTypes_t; 52 61 62 typedef size_t level_t; 63 typedef size_t node_t; 64 typedef std::multimap< level_t, node_t > nodes_per_level_t; 65 typedef std::set<node_t> nodes_t; 66 typedef std::set<nodes_t> set_of_nodes_t; 67 68 typedef boost::bimap< 69 boost::bimaps::set_of< size_t >, 70 boost::bimaps::multiset_of< Extractors::ParticleType_t > 71 > type_index_lookup_t; 72 73 typedef std::set<node_t> set_type; 74 typedef std::set<set_type> powerset_type; 75 76 typedef boost::adjacency_list < boost::vecS, boost::vecS, boost::undirectedS, 77 boost::property<boost::vertex_name_t, atomId_t>, 78 boost::property<boost::vertex_color_t, boost::default_color_type> /* needed for limited-depth DFS, 79 otherwise the property_map gets full size of graph */ 80 > UndirectedGraph; 81 typedef boost::subgraph< UndirectedGraph > UndirectedSubgraph; 82 83 typedef boost::property_map < UndirectedGraph, boost::vertex_index_t >::type index_map_t; 84 85 typedef std::map< node_t, std::pair<Extractors::ParticleType_t, size_t> > node_FragmentNode_map_t; 86 87 typedef std::map< argument_t::indices_t, size_t> argument_placement_map_t; 88 89 typedef std::map<size_t, size_t> argindex_to_nodeindex_t; 90 91 /** 92 * I have no idea why this is so complicated with BGL ... 93 * 94 * This is taken from the book "The Boost Graph Library: User Guide and Reference Manual, Portable Documents", 95 * chapter "Basic Graph Algorithms", example on calculating the bacon number. 96 */ 97 template <typename DistanceMap> 98 class distance_recorder : public boost::default_bfs_visitor 99 { 100 public: 101 distance_recorder(DistanceMap dist) : d(dist) {} 102 103 template <typename Edge, typename Graph> 104 void tree_edge(Edge e, const Graph &g) const { 105 typename boost::graph_traits<Graph>::vertex_descriptor u = source(e,g), v = target(e,g); 106 d[v] = d[u] + 1; 107 } 108 109 private: 110 DistanceMap d; 111 }; 112 113 template <typename DistanceMap> 114 distance_recorder<DistanceMap> record_distance(DistanceMap d) 115 { 116 return distance_recorder<DistanceMap>(d); 117 } 118 119 HomologyGraph createHomologyGraphFromNodes( 120 const nodes_t &nodes, 121 const type_index_lookup_t &type_index_lookup, 122 const UndirectedGraph &graph, 123 const index_map_t &index_map 124 ); 125 126 void generateAllInducedConnectedSubgraphs( 127 const size_t N, 128 const level_t level, 129 const nodes_t &nodes, 130 set_of_nodes_t &set_of_nodes, 131 const nodes_per_level_t &nodes_per_level, 132 const UndirectedGraph &graph, 133 const std::vector<size_t> &_distance, 134 const index_map_t &index_map); 135 53 136 /** Namespace for some internal helper functions. 54 137 *
Note:
See TracChangeset
for help on using the changeset viewer.