Connect all the islands by bridges using the given numbers. Create as many bridges to/from…