本文整理汇总了C++中graph_access::resizeSecondPartitionIndex方法的典型用法代码示例。如果您正苦于以下问题:C++ graph_access::resizeSecondPartitionIndex方法的具体用法?C++ graph_access::resizeSecondPartitionIndex怎么用?C++ graph_access::resizeSecondPartitionIndex使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类graph_access
的用法示例。
在下文中一共展示了graph_access::resizeSecondPartitionIndex方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: set_mis_for_individuum
void population_mis::set_mis_for_individuum(MISConfig & config, graph_access & G, individuum_mis & ind, bool secondary) {
G.resizeSecondPartitionIndex(G.number_of_nodes());
forall_nodes(G, node) {
if (!secondary) G.setPartitionIndex(node, ind.solution[node]);
else G.setSecondPartitionIndex(node, ind.solution[node]);
} endfor
}
示例2: contract
// for documentation see technical reports of christian schulz
void contraction::contract(const PartitionConfig & partition_config,
graph_access & G,
graph_access & coarser,
const Matching & edge_matching,
const CoarseMapping & coarse_mapping,
const NodeID & no_of_coarse_vertices,
const NodePermutationMap & permutation) const {
if(partition_config.combine) {
coarser.resizeSecondPartitionIndex(no_of_coarse_vertices);
}
std::vector<NodeID> new_edge_targets(G.number_of_edges());
forall_edges(G, e) {
new_edge_targets[e] = coarse_mapping[G.getEdgeTarget(e)];
} endfor
std::vector<EdgeID> edge_positions(no_of_coarse_vertices, UNDEFINED_EDGE);
//we dont know the number of edges jet, so we use the old number for
//construction of the coarser graph and then resize the field according
//to the number of edges we really got
coarser.start_construction(no_of_coarse_vertices, G.number_of_edges());
NodeID cur_no_vertices = 0;
forall_nodes(G, n) {
NodeID node = permutation[n];
//we look only at the coarser nodes
if(coarse_mapping[node] != cur_no_vertices)
continue;
NodeID coarseNode = coarser.new_node();
coarser.setNodeWeight(coarseNode, G.getNodeWeight(node));
if(partition_config.combine) {
coarser.setSecondPartitionIndex(coarseNode, G.getSecondPartitionIndex(node));
}
// do something with all outgoing edges (in auxillary graph)
forall_out_edges(G, e, node) {
visit_edge(G, coarser, edge_positions, coarseNode, e, new_edge_targets);
} endfor