Add degenerate case handling, low deg vertices and disconnected graphs and fixing some bugs