假装以下类型定义和定义:
#include <boost/graph/adjacency_list.hpp>
using namespace boost;
int main()
{
typedef adjacency_list<vecS, vecS, directedS, property<vertex_index_t, int> > GraphTC;
GraphTC g;
typedef typename property_map<GraphTC, vertex_index_t>::const_type VertexIndexMap;
VertexIndexMap index_map = get(vertex_index, g);
typedef typename graph_traits<GraphTC>::vertex_descriptor tc_vertex;
std::vector<tc_vertex> to_tc_vec(num_vertices(g));
iterator_property_map < tc_vertex *, VertexIndexMap, tc_vertex, tc_vertex&>
g_to_tc_map(&to_tc_vec[0], index_map);
}
我有一个算法输出我 g 和 g_to_tc_map (如上)。现在,我需要通过 g_to_tc_map 置换节点(我认为,这类似于整数数组或 std::map)。
注意:我发现有一个 boost/graph/detail/permutation.hpp,但我不知道如何使用它(甚至得到只包括这个文件的错误,与其他标题冲突)。
感谢任何想法/代码如何进行这种排列。