On 19.11.2014 17:13, Didier Guillevic wrote:
> Hi,
>
> I want to add a ‘weight’ edge attribute with weights ranging from 1 to 100 
> (values that fit in an unsigned char).  In order to save some space, I would 
> like to store those weights in an uint8_t instead of int16_t. The uint8_t is 
> accessible through the ‘bool’ type name for the Property Maps.
>
> - I checked that serializing and de-serializing ‘bool’ type names with values 
> in the range [1-100] works fine.
> - I also checked that running PageRank using the ‘weight’ edge property gives 
> the same result whether the weights ([1-100]) are stored as type ‘bool’ or 
> type ‘int16_t’.
>
> My question is it safe to assume that it will always work.  Do some of the 
> algorithms check the type name of the property and seeing ‘bool’, those 
> algorithms could decide to use true/false values rather than an integer in 
> range [0-255].

Yes, this is totally safe. "bool" is a just a synonym to "uint8_t"
everywhere in the library, as far as property maps are concerned.

Best,
Tiago

-- 
Tiago de Paula Peixoto <[email protected]>

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
graph-tool mailing list
[email protected]
http://lists.skewed.de/mailman/listinfo/graph-tool

Reply via email to