I'm using boost 1.31.0 and gcc 3.4.2.
While this problem is more of an application code problem, since I got
no help on other lists, I trying this one with hopes of a response.
I need to identify parallel edges from my graph, which is defined as:
typedef subgraph,
EdgeProperty> > DataGraphT;
typedef boost::graph_traits <DataGraphT>::edge_descriptor DataEdge;
In the test case that I'm working on, I know I have parallel edges,
actually 4 sets of 3.
I'd like to use this code:
DataGraph::handleParallelEdges(void)
{
typedef multiset Edges;
Edges edges;
graph_traits<DataGraphT>::edge_iterator ei,ei_end;
for (tie(ei,ei_end)=boost::edges(dataGraph_);ei!=ei_end;++ei)
edges.insert(*ei);
for (Edges::const_iterator iter = edges.begin(); iter != edges.end();
advance(iter,edges.count(*iter)))
if (edges.count(*iter)>1)
cout << "See duplicate" << endl;
}
However, when count never returns.
The likely cause of this (I suspect) is the ltSubgraph functor.
Its definition is:
struct ltSubgraph : public std::binary_function
{
bool operator() (const DataEdge& s1, const DataEdge& s2) const
{
return s1.m_source < s2.m_source ||
(!(s1.m_source < s2.m_source) && s1.m_target < s2.m_target);
}
};
I say this because I can see that this functor is being continuously
called in this infinite loop.
Note that I use this functor in multiple other cases, but not with an
associate container that allows duplicate keys.
Is there a problem with this code?