Changeset f5ea10 for src/Graph


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.
Location:
src/Graph
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • src/Graph/BoostGraphCreator.cpp

    r8d56a6 rf5ea10  
    4343
    4444#include "Atom/atom.hpp"
     45#include "Graph/Graph6Reader.hpp"
    4546#include "molecule.hpp"
    4647
     
    9495}
    9596
     97void BoostGraphCreator::createFromGraph6String(
     98    const std::string &_graph_string)
     99{
     100  Graph6Reader reader;
     101  {
     102    std::stringstream inputstream(_graph_string);
     103    reader(inputstream);
     104  }
     105
     106  graph = UndirectedGraph();
     107
     108  // add nodes
     109  for(int numbers = 0; numbers < reader.get_num_nodes(); ++numbers) {
     110    const atomId_t atomid = numbers;
     111    Vertex v = boost::add_vertex(atomid, graph);
     112    const atomId_t vertexname = boost::get(boost::get(boost::vertex_name, graph), v);
     113    const nodeId_t vertexindex = boost::get(boost::get(boost::vertex_index, graph), v);
     114    LOG(2, "DEBUG: Adding node " << vertexindex << " associated to atom #" << vertexname);
     115    ASSERT( vertexname == atomid,
     116        "BoostGraphCreator::createFromRange() - atomid "+toString(atomid)
     117        +" is not name of vertex "+toString(vertexname)+".");
     118    atomids_nodeids.insert( std::make_pair(vertexname, vertexindex) );
     119  }
     120
     121  // add edges
     122  const Graph6Reader::edges_t &edges = reader.get_edges();
     123  for(Graph6Reader::edges_t::const_iterator iter = edges.begin();
     124      iter != edges.end(); ++iter) {
     125    // graph6 contains only upper triangle of adjacency matrix, hence add only once
     126    const nodeId_t leftnodeid = iter->first;
     127    const nodeId_t rightnodeid = iter->second;
     128    boost::add_edge(leftnodeid, rightnodeid, graph);
     129  }
     130}
     131
    96132BoostGraphCreator::nodeId_t BoostGraphCreator::getNodeId(
    97133    const atomId_t &_atomid) const
  • src/Graph/BoostGraphCreator.hpp

    r8d56a6 rf5ea10  
    9090      const predicate_t &_pred);
    9191
     92  /** Creates the boost::graph from the defining graph6 string where the atom
     93   * nodes map is simply the identity.
     94   *
     95   * \param _graph_string graph6 string defining the graph
     96   */
     97  void createFromGraph6String(
     98      const std::string &_graph_string);
     99
    92100  /** Getter for the created graph.
    93101   *
  • src/Graph/Makefile.am

    r8d56a6 rf5ea10  
    1010        Graph/ConnectedSubgraph.cpp \
    1111        Graph/CyclicStructureAnalysis.cpp \
    12         Graph/DepthFirstSearchAnalysis.cpp
    13                                  
     12        Graph/DepthFirstSearchAnalysis.cpp \
     13        Graph/Graph6Reader.cpp
     14
    1415GRAPHHEADER = \
    1516        Graph/AdjacencyList.hpp \
     
    2324        Graph/CyclicStructureAnalysis.hpp \
    2425        Graph/DepthFirstSearchAnalysis.hpp \
     26        Graph/Graph6Reader.hpp \
    2527        Graph/ListOfLocalAtoms.hpp
    2628
Note: See TracChangeset for help on using the changeset viewer.