Using ELK with Archi for automatic diagram layouts

Started by fanievh, April 22, 2025, 09:32:24 AM

Previous topic - Next topic

fanievh

Hi,

Has anyone implemented automatic diagram layouts in Archi, either in a plugin or in Javascript? In looking at the options, the Eclipse Layout Kernel looks like a promising option: https://eclipse.dev/elk/

Some background: I have built a plugin that creates or updates Application elements in Archi from a company API that stores a central reference for all Applications.  I also have a script running in JArchi that generates application landscape views from these application elements.  The views are however based on a static reference layout using a packing algorithm to size the various enclosing boxes (groups). I want to expand the use case to also create / update servers and other infrastructure elements and possibly capabilities for each application element.  I will do that in the plugin.  To generate the views, I think I need a more generalised automatic layout solution. I could do the view generation and layout either in the plugin or in a script.

So back to automatic diagram layouts:
  • What would be the best approach / library / algorithm to do automatic layouts in Archi?
  • Would ELK be a good candidate given that Archi uses EMF?
  • Does anyone have sample code to implement org.eclipse.elk.core.service.ILayoutSetup and org.eclipse.elk.core.service.IDiagramLayoutConnector in Archi?
  • Are there any plans in the Archi roadmap to implement automatic diagram layout functionality?

Thanks,
Fanie van Heerden

Phil Beauvoir

If you value and use Archi, please consider making a donation.
Ask your ArchiMate related questions to the ArchiMate Community's Discussion Board.

fanievh


Alexis_H

Hi @fanievh,

I've went the same path as you do : generated via jArchi some basic 'catalog' views to list applications, capabilities .. and faced the difficulty to layout them : after writing a basic JS layout algorithm from scratch, I found the ELK project and started implemented a PoC, you'll find some starting point in my github repos : https://github.com/AlexisHFr/archi-contribs

Unfortunately I didn't had enough time (or motivation) to finalize it yet..

Regards,
Alexis

fanievh

Hi Alexis, thank you.  I've downloaded your code and have it more or less working (I didn't used you your forked version of the Archi code so a few things don't work). The layout algorithm I think might work for me is Layered but I think I need to set the hierarchyHandling option to SEPARATE_CHILDREN: https://eclipse.dev/elk/reference/options/org-eclipse-elk-hierarchyHandling.html

I don't see that option in the ELK Layout View that's contributed in the workbench so will probably just set it in code for now.  It doesn't look like all the relevant layout algorithm properties are displayed in the layout view.

Your code has helped a lot.  For my use cases I will constrain the layouts and properties per use case i.e. I'm not even attempting to get a generalised layout solution.  Thanks for writing the code and contributing it!

Alexis_H

Hi @fanievh, you're welcome. Nice to hear that it helped you.

I didn't found enough available time to finalize this ELK/Archi integration, maybe I will in the summer time ;)

Regards,
Alexis