Skip to content

Commit de77f26

Browse files
committed
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.
1 parent f5f32da commit de77f26

File tree

1 file changed

+10
-18
lines changed

1 file changed

+10
-18
lines changed

src/util/graph.h

+10-18
Original file line numberDiff line numberDiff line change
@@ -575,12 +575,11 @@ std::size_t grapht<N>::connected_subgraphs(
575575

576576
const nodet &node=nodes[n];
577577

578-
for(typename edgest::const_iterator
579-
it=node.out.begin();
580-
it!=node.out.end();
581-
it++)
582-
if(!visited[*it])
583-
s.push(*it);
578+
for(const auto &o : node.out)
579+
{
580+
if(!visited[o.first])
581+
s.push(o.first);
582+
}
584583
}
585584

586585
nr++;
@@ -671,20 +670,13 @@ void grapht<N>::make_chordal()
671670
const nodet &n=tmp[i];
672671

673672
// connect all the nodes in n.out with each other
674-
675-
for(typename edgest::const_iterator
676-
it1=n.out.begin();
677-
it1!=n.out.end();
678-
it1++)
679-
for(typename edgest::const_iterator
680-
it2=n.out.begin();
681-
it2!=n.out.end();
682-
it2++)
673+
for(const auto &o1 : n.out)
674+
for(const auto &o2 : n.out)
683675
{
684-
if(*it1!=*it2)
676+
if(o1.first!=o2.first)
685677
{
686-
tmp.add_undirected_edge(*it1, *it2);
687-
this->add_undirected_edge(*it1, *it2);
678+
tmp.add_undirected_edge(o1.first, o2.first);
679+
this->add_undirected_edge(o1.first, o2.first);
688680
}
689681
}
690682

0 commit comments

Comments
 (0)