Using a set with kruskal_minimum_spanning_tree
I've sucessfully created an program that uses kruskal_minimum_spanning_tree. I presently give a vector container to this algorithm, which it populates in providing its answer. Now I want to optimize my program by switching to set. For vector, I use "back_inserter(m_spanningTreeEdges)". For set, I've attempted to use "inserter(m_spanningTreeEdges,m_spanningTreeEdges.end())", but this doesn't work. Can somebody tell me the correct way to code this, or tell me that it isn't possible?
My mistake, I forgot the edge descriptors don't have an operator< method and hense an associated container using them as a key must have an approbriate predicate. Works fine now. Jeffrey Holle wrote:
I've sucessfully created an program that uses kruskal_minimum_spanning_tree. I presently give a vector container to this algorithm, which it populates in providing its answer.
Now I want to optimize my program by switching to set.
For vector, I use "back_inserter(m_spanningTreeEdges)".
For set, I've attempted to use "inserter(m_spanningTreeEdges,m_spanningTreeEdges.end())", but this doesn't work.
Can somebody tell me the correct way to code this, or tell me that it isn't possible?
participants (1)
-
Jeffrey Holle