biomcmc-lib  0.1
low level library for phylogenetic analysis
Data Structures | Typedefs | Functions
hashtable.h File Reference

double hashing open-address hash table using strings as key – also has distance matrix, that can be used in alignments and trees More...

#include "hashfunctions.h"
Include dependency graph for hashtable.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  hashtable_item_struct
 key/value pair for hash table More...
 
struct  hashtable_struct
 Hash table (vector indexed by strings). More...
 
struct  bip_hashtable_struct
 Hash table of bipartitions (see hashtable.h for original version, with string keys and integer values) More...
 
struct  bip_hashitem_struct
 key (bipartition) and value (frequency) pair for hash table of bipartitions More...
 

Typedefs

typedef struct hashtable_structhashtable
 
typedef struct hashtable_item_structhashtable_item
 
typedef struct bip_hashtable_structbip_hashtable
 
typedef struct bip_hashitem_structbip_hashitem
 

Functions

void insert_hashtable (hashtable ht, char *key, int value)
 Insert key/value pair into hashtable.
 
int lookup_hashtable (hashtable ht, char *key)
 Return location (value) of corresponding key (string) or negative value if not found.
 
hashtable new_hashtable (int size)
 Create new hashtable of size elements.
 
void del_hashtable (hashtable ht)
 Free hashtable space.
 
bip_hashtable new_bip_hashtable (int size)
 Create new hashtable of size bipartitions.
 
void del_bip_hashtable (bip_hashtable ht)
 Free bipartition hashtable space.
 
void bip_hashtable_insert (bip_hashtable ht, bipartition key)
 Insert key (bipartition) into bipartition hashtable, adding one to its count (freq).
 
double bip_hashtable_get_frequency (bip_hashtable ht, bipartition key)
 Return frequency of bipartition (count/maxfreq) or zero if not found.
 

Detailed Description

double hashing open-address hash table using strings as key – also has distance matrix, that can be used in alignments and trees

Hash tables allow us to search for the position of a key (taxa name) without scanning the whole vector (like in sequencial search). This code is derived from the software DCM3, released under the GPL license (Copyright (C) 2004 The University of Texas at Austin).