Dear colleagues, good day!

I kindly ask you not to judge me harshly for my question, as I have limited experience in writing scripts. I have already created some complex scripts, but still, my experience is not extensive enough, which is why I have to ask seemingly "silly" questions.

Currently, I'm working on a script to export an RACI matrix for department positions. For the first time in my experience, I need to traverse all the "nodes" of the model, starting from the root. At the moment, I'm not entirely clear about the following:

  1. From the perspective of ARIS, is an organizational structure model considered a graph or a tree? And accordingly, which algorithm is best to use for traversing the structure (graph or tree)?

  2. I plan to first traverse the entire structure, gather data about the objects in the organizational structure model, their hierarchy, and relationship types. I need to store this information somehow in order to later search for connections with business process models, generate report views, and so on. However, I'm not sure how to store this data effectively. Initially, I thought about creating a separate object (in this case, "object" is a term from the point of view of object-oriented programming) for the parent Organizational Unit, and store an array of child object occurrencies  within it. However, this approach won't work as departments can have multiple levels of nesting.

I kindly request the esteemed community to help me find answers to these questions.