Crossings Minimization  1.0
hash.h File Reference

A simple map based on a hash table, maps names to node pointers. More...

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

Go to the source code of this file.

Functions

void initHashTable (int number_of_items)
 
void insertInHashTable (const char *name, Nodeptr node)
 
Nodeptr getFromHashTable (const char *name)
 
void removeHashTable ()
 
double getAverageNumberOfProbes ()
 

Detailed Description

A simple map based on a hash table, maps names to node pointers.

Author
Matthias Stallmann
Date
2008/12/21
Id
hash.h 2 2011-06-07 19:50:41Z mfms

Definition in file hash.h.

Function Documentation

◆ getAverageNumberOfProbes()

double getAverageNumberOfProbes ( )
Returns
The average number of probes per call to insert or get.

Definition at line 111 of file hash.c.

References getIndex(), hashIndex(), hashValue(), modulus, number_of_accesses, and number_of_probes.

Referenced by printGraph().

Here is the call graph for this function:

◆ getFromHashTable()

Nodeptr getFromHashTable ( const char *  name)

Retrieves a node from the table, given its name

Returns
A pointer to a node with the given name if found, NULL otherwise.

Definition at line 100 of file hash.c.

References getIndex().

Referenced by addEdge(), and incrementDegrees().

Here is the call graph for this function:

◆ initHashTable()

void initHashTable ( int  number_of_items)

Initializes the hash table so that it can "comfortably" accommodate the given number of items

Definition at line 69 of file hash.c.

References getTableSize(), modulus, number_of_accesses, and number_of_probes.

Referenced by getIndex(), and readGraph().

Here is the call graph for this function:

◆ insertInHashTable()

void insertInHashTable ( const char *  name,
Nodeptr  node 
)

Inserts A node into the hash table. Assumes that the node is not already present (fatal error otherwise)

Definition at line 81 of file hash.c.

References getIndex(), hashIndex(), hashValue(), and node_struct::name.

Referenced by getIndex(), and makeNode().

Here is the call graph for this function:

◆ removeHashTable()

void removeHashTable ( )

Deallocates the memory used by the table

Definition at line 106 of file hash.c.

Referenced by readGraph().