script for building keyword graph