Ignore:
Timestamp:
Jun 22, 2018, 7:26:09 AM (7 years ago)
Author:
Frederik Heber <frederik.heber@…>
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)
Message:

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.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/FunctionApproximation/Extractors.cpp

    r8d56a6 rf5ea10  
    3434#include <config.h>
    3535#endif
    36 
    37 #include <boost/graph/adjacency_list.hpp>
    38 #include <boost/graph/breadth_first_search.hpp>
    39 #include <boost/graph/subgraph.hpp>
    4036
    4137//#include "CodePatterns/MemDebug.hpp"
     
    4844#include <vector>
    4945#include <boost/assign.hpp>
    50 #include <boost/bimap.hpp>
    51 #include <boost/bimap/set_of.hpp>
    52 #include <boost/bimap/multiset_of.hpp>
    5346#include <boost/bind.hpp>
    5447#include <boost/foreach.hpp>
     
    6760
    6861using namespace boost::assign;
     62
     63using namespace Extractors;
    6964
    7065FunctionModel::arguments_t
     
    186181}
    187182
    188 typedef size_t level_t;
    189 typedef size_t node_t;
    190 typedef std::multimap< level_t, node_t > nodes_per_level_t;
    191 typedef std::set<node_t> nodes_t;
    192 typedef std::set<nodes_t> set_of_nodes_t;
    193 typedef boost::property_map < boost::adjacency_list <>, boost::vertex_index_t >::type index_map_t;
    194 
    195 typedef boost::bimap<
    196     boost::bimaps::set_of< size_t >,
    197     boost::bimaps::multiset_of< Extractors::ParticleType_t >
    198 > type_index_lookup_t;
    199 
    200 typedef std::set<node_t> set_type;
    201 typedef std::set<set_type> powerset_type;
    202 
    203 typedef boost::adjacency_list < boost::vecS, boost::vecS, boost::undirectedS,
    204     boost::no_property, boost::no_property > UndirectedGraph;
    205 typedef boost::subgraph< UndirectedGraph > UndirectedSubgraph;
    206 
    207 typedef std::map< node_t, std::pair<Extractors::ParticleType_t, size_t> > node_FragmentNode_map_t;
    208 
    209 typedef std::map< argument_t::indices_t, size_t> argument_placement_map_t;
    210 
    211 typedef std::map<size_t, size_t> argindex_to_nodeindex_t;
    212 
    213183void insertIntoNodeFragmentMap(
    214184    node_FragmentNode_map_t &_node_FragmentNode_map,
     
    334304 * \param index_map with indices per \a graph' vertex
    335305 */
    336 static void generateAllInducedConnectedSubgraphs(
     306void Extractors::generateAllInducedConnectedSubgraphs(
    337307    const size_t N,
    338308    const level_t level,
     
    438408}
    439409
    440 static HomologyGraph createHomologyGraphFromNodes(
     410HomologyGraph Extractors::createHomologyGraphFromNodes(
    441411    const nodes_t &nodes,
    442412    const type_index_lookup_t &type_index_lookup,
     
    501471
    502472  return HomologyGraph(graph_nodes, graph_edges);
    503 }
    504 
    505 /**
    506  * I have no idea why this is so complicated with BGL ...
    507  *
    508  * This is taken from the book "The Boost Graph Library: User Guide and Reference Manual, Portable Documents",
    509  * chapter "Basic Graph Algorithms", example on calculating the bacon number.
    510  */
    511 template <typename DistanceMap>
    512 class distance_recorder : public boost::default_bfs_visitor
    513 {
    514 public:
    515   distance_recorder(DistanceMap dist) : d(dist) {}
    516 
    517   template <typename Edge, typename Graph>
    518   void tree_edge(Edge e, const Graph &g) const {
    519     typename boost::graph_traits<Graph>::vertex_descriptor u = source(e,g), v = target(e,g);
    520     d[v] = d[u] + 1;
    521   }
    522 
    523 private:
    524   DistanceMap d;
    525 };
    526 
    527 template <typename DistanceMap>
    528 distance_recorder<DistanceMap> record_distance(DistanceMap d)
    529 {
    530   return distance_recorder<DistanceMap>(d);
    531473}
    532474
Note: See TracChangeset for help on using the changeset viewer.