sorting input edges with multiple core if available
This commit is contained in:
		
							parent
							
								
									94c8c61a05
								
							
						
					
					
						commit
						10ea331909
					
				| @ -22,7 +22,11 @@ or see http://www.gnu.org/licenses/agpl.txt. | |||||||
| #define STATICGRAPH_H_INCLUDED | #define STATICGRAPH_H_INCLUDED | ||||||
| 
 | 
 | ||||||
| #include <vector> | #include <vector> | ||||||
|  | #ifdef _GLIBCXX_PARALLEL | ||||||
|  | #include <parallel/algorithm> | ||||||
|  | #else | ||||||
| #include <algorithm> | #include <algorithm> | ||||||
|  | #endif | ||||||
| 
 | 
 | ||||||
| #include "../typedefs.h" | #include "../typedefs.h" | ||||||
| 
 | 
 | ||||||
| @ -45,8 +49,11 @@ public: | |||||||
|     }; |     }; | ||||||
| 
 | 
 | ||||||
|     StaticGraph( int nodes, std::vector< InputEdge > &graph ) { |     StaticGraph( int nodes, std::vector< InputEdge > &graph ) { | ||||||
| 
 | #ifdef _GLIBCXX_PARALLEL | ||||||
|  |         __gnu_parallel::sort( graph.begin(), graph.end() ); | ||||||
|  | #else | ||||||
|         std::sort( graph.begin(), graph.end() ); |         std::sort( graph.begin(), graph.end() ); | ||||||
|  | #endif | ||||||
|         _numNodes = nodes; |         _numNodes = nodes; | ||||||
|         _numEdges = ( EdgeIterator ) graph.size(); |         _numEdges = ( EdgeIterator ) graph.size(); | ||||||
|         _nodes.resize( _numNodes + 1); |         _nodes.resize( _numNodes + 1); | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user