Align and reorder elements

Hi, I would like to ask if you know about some function that can be invoked and that re allign or reorder the entire diagram in bpmnjs.
I recursively add other task to the process and in the end the entire diagram is a mess. So… exists some function that can help me or do i need to implement it by myself.
Thank in advance for the answer.

Could you share a (visual) example what you want to accomplish?

From a messy diagram

To an ordered and aligned one
Screenshot 2024-04-23 alle 10.49.38

I need to add dynamically elements in my diagram and i’m searching for a function olready built that is able to reorder and re align the diagram if exists