Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Eclipse Layout Kernel » Guidance on invoking AllCrossingsCounter(Unsuccessful at AllCrossingsCounter with IInitializable)
Guidance on invoking AllCrossingsCounter [message #1858257] Sat, 25 March 2023 03:47 Go to next message
Michael Lynott is currently offline Michael LynottFriend
Messages: 11
Registered: September 2021
Junior Member
Added Sun 3/26 US MDT
By reviewing the code of the classes that use IInitializer I learned how to create a set of IInitializables, and then initialize the relevant class. In so doing,
I answered all the questions I posed in the original post.

I discovered that the approach I outlined below is not appropriate to accomplish my goal. I am writing a crossing-checker for my final graph that does not depend on levels. I examine instead the set of y-positions of the vertices, and create level-equivalents from that set of values instead.

It would have been useful to show an example of how to begin working with one of the IInitializable classes. These are the steps I took to attempt that. Please let me know whether this is appropriate, so others can see it (or your corrected version). Thanks.

Begin code snippet for using a class that implements IInitializable
/*
* "lg" is my "L-Graph".

* Find the node array that AllCrossingsCounter needs as input
*/
LNode currentOrder[][] = lg.toNodeArray();

/*
* Instantiate crossingsCounter: a new AllCrossingsCounter
*/
AllCrossingsCounter crossingsCounter =
new AllCrossingsCounter(currentOrder);

/*
* Create a list (using Google Guava "Lists" Collection)
* of one element, crossingsCounter.
*/
List<IInitializable> initializables =
Lists.newArrayList(crossingsCounter);

/*
* I-Initialize crossingsCounter
*/
IInitializable.init(initializables, currentOrder);
/* or crossingsCounter.init(initializables, currentOrder): */ ??

End code snippet for using a class that implements IInitializable.

Mike


Original message below:
I'm building a tool to draw a specific kind of diagram.
My goal with this code is to count line crossings of the final graph.
The approach I outline below is time-consuming, but that's okay.
I'm trying to minimize the amount of code I write for this exercise.

Here is my approach:

Create a "K-graph" and process it with the Layered option

Because I want to use existing code as much as possible, I found AllCrossingsCounter so I did the following:

ElkGraphTransformer egt = new ElkGraphTransformer();
lg = egt.importGraph(graphIn); # graphIn is a "K-graph"
egt.applyLayout(lg);

I want to invoke AllCrossingsCounter so I retrieve "nodeOrder"
final LNode[][] nodeOrder = lg.toNodeArray();
Then I get the list of Layers, as the other "init" parameter for AllCrossingsCounter
List<Layer> LayerList = lg.getLayers();

I attempted to do the following (which fails):
AllCrossingsCounter.init(LayerList, nodeOrder);

Questions:
1. Is this a sensible approach to finding crossings in the final graph? I could just reproduce a cross-counting algorithm I learned elsewhere but that would require me to write and test more code.

2. How should I assemble the List that is needed as the first parameter to AllCrossingsCounter?

3. How should I invoke AllCrossingsCounter.init correctly?

Thank you for your help. And thank you for version 0.8.1.
Mike

[Updated on: Mon, 27 March 2023 03:59]

Report message to a moderator

Re: Guidance on invoking AllCrossingsCounter [message #1858285 is a reply to message #1858257] Mon, 27 March 2023 07:08 Go to previous message
Sören Domrös is currently offline Sören DomrösFriend
Messages: 14
Registered: June 2021
Junior Member
Hi Mike,
we usually count the crossings directly inside the algorithm. We also have solutions to do this afterward using this. We count the crossings as part of the crossing minimization step if they should impact the decision of the algorithm. here it is only important that the number of counted crossings is order-preserving in a sense that more counted crossings mean more real crossings. If we want to know their number afterward, we use the linked analysis.
I guess your other questions might be answered by having a look at the corresponding test.
If you have further questions feel free to ask.
Regards Sören
Previous Topic:elk Demo program fails during injector creation process
Next Topic:Error installing Kieler (to get Gml Importer)
Goto Forum:
  


Current Time: Tue Jul 23 13:06:44 GMT 2024

Powered by FUDForum. Page generated in 0.02929 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top