Changeset d83d64 for src/Graph/BoostGraphCreator.cpp
- Timestamp:
- Jun 21, 2018, 9:12:08 AM (7 years ago)
- Children:
- a951f3
- Parents:
- 8d56a6
- git-author:
- Frederik Heber <frederik.heber@…> (09/26/17 22:30:01)
- git-committer:
- Frederik Heber <frederik.heber@…> (06/21/18 09:12:08)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Graph/BoostGraphCreator.cpp
r8d56a6 rd83d64 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
Note:
See TracChangeset
for help on using the changeset viewer.