Each region has a culture associated with it. When you annex a region, it checks the culture of that region and adds it to a dictionary which every country has with the key being the culture, and the item being a list of all the regions the country owns with that culture. From that, you can get the region ids of each region in a province by just getting the item associated with a certain key within the country class.
Viewing post in Spirits of Steel: A New Dawn comments
The regions are all represented by one large dictionary where the first element is a unique color associated with that on the region map, the second is it's location on the map, and the third is a list of every region which that region connects to. It works to be a very rudimentary way of implementing a graph data structure.