Added graph minimization by removing duplicate connections
Bug fixes