added empty patterns to implement Dijstra shortest path algorithm