generate_ids function

Generates vertex ids.