implement matrix and some graph generators