- 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)
- Location:
- src/Graph
- Files:
-
- 2 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Graph/BoostGraphCreator.cpp
r8d56a6 rf5ea10 43 43 44 44 #include "Atom/atom.hpp" 45 #include "Graph/Graph6Reader.hpp" 45 46 #include "molecule.hpp" 46 47 … … 94 95 } 95 96 97 void 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 96 132 BoostGraphCreator::nodeId_t BoostGraphCreator::getNodeId( 97 133 const atomId_t &_atomid) const -
src/Graph/BoostGraphCreator.hpp
r8d56a6 rf5ea10 90 90 const predicate_t &_pred); 91 91 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 92 100 /** Getter for the created graph. 93 101 * -
src/Graph/Makefile.am
r8d56a6 rf5ea10 10 10 Graph/ConnectedSubgraph.cpp \ 11 11 Graph/CyclicStructureAnalysis.cpp \ 12 Graph/DepthFirstSearchAnalysis.cpp 13 12 Graph/DepthFirstSearchAnalysis.cpp \ 13 Graph/Graph6Reader.cpp 14 14 15 GRAPHHEADER = \ 15 16 Graph/AdjacencyList.hpp \ … … 23 24 Graph/CyclicStructureAnalysis.hpp \ 24 25 Graph/DepthFirstSearchAnalysis.hpp \ 26 Graph/Graph6Reader.hpp \ 25 27 Graph/ListOfLocalAtoms.hpp 26 28
Note:
See TracChangeset
for help on using the changeset viewer.