Fix: several grapht functions were uncompilable if ever called

edgest is a map from node_indext to some type edget. In order to access the node_indext, you must access the first element of the pair.

I've also updated the iterators.
This commit is contained in:
Polgreen 2018-06-20 15:36:58 +02:00 committed by Chris Smowton
parent b9014de31f
commit d00d833398
1 changed files with 10 additions and 18 deletions

View File

@ -709,12 +709,11 @@ std::size_t grapht<N>::connected_subgraphs(
const nodet &node=nodes[n]; const nodet &node=nodes[n];
for(typename edgest::const_iterator for(const auto &o : node.out)
it=node.out.begin(); {
it!=node.out.end(); if(!visited[o.first])
it++) s.push(o.first);
if(!visited[*it]) }
s.push(*it);
} }
nr++; nr++;
@ -805,20 +804,13 @@ void grapht<N>::make_chordal()
const nodet &n=tmp[i]; const nodet &n=tmp[i];
// connect all the nodes in n.out with each other // connect all the nodes in n.out with each other
for(const auto &o1 : n.out)
for(typename edgest::const_iterator for(const auto &o2 : n.out)
it1=n.out.begin();
it1!=n.out.end();
it1++)
for(typename edgest::const_iterator
it2=n.out.begin();
it2!=n.out.end();
it2++)
{ {
if(*it1!=*it2) if(o1.first!=o2.first)
{ {
tmp.add_undirected_edge(*it1, *it2); tmp.add_undirected_edge(o1.first, o2.first);
this->add_undirected_edge(*it1, *it2); this->add_undirected_edge(o1.first, o2.first);
} }
} }