Since OP wants a hash function, therefore implying hashtable, this answer is not really applicable to the question, but as for my reasons for favoring array:
Your method simply involves assigning an incrementing value to each vertex, you can just use those values to index into an array to identify each vertex. To handle connections, depending on if the graph is directed or not, you can choose between a balanced tree or disjoint-set data structure (
http://en.wikipedia.org/wiki/Disjoint-set_data_structure ).
I try to stay away from hashtables because they tend to trade space for efficiency. In some cases this might not be noticeable and actually encouraged but in a something like a graph, hashing every vertex and every connection is calling for trouble as the density of the graph increases.
I suggest balanced tree for directed graph connections but this could be replaced by arrays for small graphs. If performance becomes an issue (i.e. density of graph increases), the storage can be upgraded to a balanced tree (RB tree for example).
Disjoint-set is good for undirected graphs not only because of the performance (with optimizations can perform at amortized O(1)) but because it uses the same space as an array but can perform as well as (if not better than) a balanced binary tree. Another reason why I suggest this is because everything in a connected component (a subset of a disjoint-set) is connected (has an edge) to each other, and this is not desirable in a directed graph
Implementation of disjoint-set (in python)
https://drive.google.com/file/d/0B3YhWUWL5lcgOG9XcU8tTDRiZVU/edit?usp=sharing