Mercurial > hg > nsaunier > traffic-intelligence
view python/tests/utils.txt @ 190:36968a63efe1
Got the connected_components to finally work using a vecS for the vertex list in the adjacency list.
In this case, the component map is simply a vector of ints (which is the type of UndirectedGraph::vextex_descriptor (=graph_traits<FeatureGraph>::vertex_descriptor) and probably UndirectedGraph::vertices_size_type).
To use listS, I was told on the Boost mailing list:
>> If you truly need listS, you will need to create a vertex index
>> map, fill it in before you create the property map, and pass it to the
>> vector_property_map constructor (and as a type argument to that class).
It may be feasible with a component map like
shared_array_property_map< graph_traits<FeatureGraph>::vertex_descriptor, property_map<FeatureGraph, vertex_index_t>::const_type > components(num_vertices(g), get(vertex_index, g));
| author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
|---|---|
| date | Wed, 07 Dec 2011 18:51:32 -0500 |
| parents | 74b1fc68d4df |
| children | 5957aa1d69e1 |
line wrap: on
line source
>>> from utils import * >>> from moving import Point >>> computeChi2([],[]) 0.0 >>> computeChi2(range(1,10),range(1,10)) 0.0 >>> computeChi2(range(1,9),range(1,10)) 0.0 >>> ceilDecimals(1.23, 0) 2.0 >>> ceilDecimals(1.23, 1) 1.3 >>> inBetween(1,2,1.5) True >>> inBetween(2.1,1,1.5) True >>> inBetween(1,2,0) False >>> f = openCheck('non_existant_file.txt') File non_existant_file.txt could not be opened. >>> removeExtension('test-adfasdf.asdfa.txt') 'test-adfasdf.asdfa' >>> removeExtension('test-adfasdf') 'test-adfasdf' >>> values = line2Ints('1 2 3 5 6') >>> values[0] 1 >>> values[-1] 6 >>> values = line2Floats('1.3 2.45 7.158e+01 5 6') >>> values[0] 1.3 >>> values[2] #doctest: +ELLIPSIS 71.5... >>> values[-1] 6.0
