Correctly mark edges going to/from core with exclude flags
This commit is contained in:
		
							parent
							
								
									30f910e861
								
							
						
					
					
						commit
						168e313f73
					
				| @ -69,6 +69,11 @@ inline auto contractExcludableGraph(ContractorGraph contractor_graph_, | |||||||
|                 }); |                 }); | ||||||
|             non_core_edges.resize(new_end - non_core_edges.begin()); |             non_core_edges.resize(new_end - non_core_edges.begin()); | ||||||
|             edge_container.Insert(std::move(non_core_edges)); |             edge_container.Insert(std::move(non_core_edges)); | ||||||
|  | 
 | ||||||
|  |             for (const auto filter_index : util::irange<std::size_t>(0, filters.size())) | ||||||
|  |             { | ||||||
|  |                 edge_container.Filter(filters[filter_index], filter_index); | ||||||
|  |             } | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         // Extract core graph for further contraction
 |         // Extract core graph for further contraction
 | ||||||
|  | |||||||
| @ -60,6 +60,25 @@ struct ContractedEdgeContainer | |||||||
|         flags.resize(edges.size(), ALL_FLAGS); |         flags.resize(edges.size(), ALL_FLAGS); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     void Filter(const std::vector<bool> &filter, std::size_t index) | ||||||
|  |     { | ||||||
|  |         BOOST_ASSERT(index < sizeof(MergedFlags) * CHAR_BIT); | ||||||
|  |         const MergedFlags flag = 1 << index; | ||||||
|  | 
 | ||||||
|  |         for (auto edge_index : util::irange<std::size_t>(0, edges.size())) | ||||||
|  |         { | ||||||
|  |             auto allowed = filter[edges[edge_index].source] && filter[edges[edge_index].target]; | ||||||
|  |             if (allowed) | ||||||
|  |             { | ||||||
|  |                 flags[edge_index] |= flag; | ||||||
|  |             } | ||||||
|  |             else | ||||||
|  |             { | ||||||
|  |                 flags[edge_index] &= ~flag; | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     void Merge(std::vector<QueryEdge> new_edges) |     void Merge(std::vector<QueryEdge> new_edges) | ||||||
|     { |     { | ||||||
|         BOOST_ASSERT(index < sizeof(MergedFlags) * CHAR_BIT); |         BOOST_ASSERT(index < sizeof(MergedFlags) * CHAR_BIT); | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user