Input: 𝐺 : The scenario graph in the form 𝐴 , 𝐸 , 𝑖 𝑛 , 𝐹
Output: 𝐺 𝑘 : ITM
Data: 𝑅 𝑒 𝑔 𝑖 𝑜 𝑛 𝐹 𝑜 𝑢 𝑛 𝑑 : a flag indicates whether a region is formed
  or not
1: RegionFound = TRUE   // Initially assumes composition is possible
2: while 𝑅 𝑒 𝑔 𝑖 𝑜 𝑛 𝐹 𝑜 𝑢 𝑛 𝑑 do
3:   𝐺 𝑘 = 𝐹 𝑜 𝑟 𝑚 𝐼 𝑛 𝑡 𝑒 𝑟 𝑚 𝑒 𝑑 𝑖 𝑎 𝑡 𝑒 𝐺 𝑟 𝑎 𝑝 ( 𝐺 , 𝑅 𝑒 𝑔 𝑖 𝑜 𝑛 𝐹 𝑜 𝑢 𝑛 𝑑 )
4:   𝐺 = 𝐺 𝑘
5: end while
6: return 𝐺 𝑘    // No more composition possible
Algorithm—Building ITM
Procedure 2: Function BuildITM.