Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NullPointerException in LayerSweepTypeDecider #1084

Open
alexanderpann opened this issue Oct 31, 2024 · 4 comments
Open

NullPointerException in LayerSweepTypeDecider #1084

alexanderpann opened this issue Oct 31, 2024 · 4 comments
Labels
bug Erroneous behaviour.

Comments

@alexanderpann
Copy link

alexanderpann commented Oct 31, 2024

Unfortunately, I can't share any reproducible example. I use ELK Layered, the offending option is hierarchy handling which is set to INCLUDE_CHILDREN. With SEPARATE_CHILDREN everything works. I think the diagram also has subdiagrams. This option is set a the root diagram level, no other direct layer options are set. Setting crossing minimization strategy to none to disable the layered sweeping didn't help, it seems to be a general problem. Any ideas how this can happen?

java.lang.NullPointerException: Cannot read field "id" because the return value of "org.eclipse.elk.alg.layered.graph.LNode.getLayer()" is null
at d.i.m.e.diagram.runtime//org.eclipse.elk.alg.layered.p3order.LayerSweepTypeDecider.nodeInfoFor(LayerSweepTypeDecider.java:216)
at d.i.m.e.diagram.runtime//org.eclipse.elk.alg.layered.p3order.LayerSweepTypeDecider.transferInfoTo(LayerSweepTypeDecider.java:145)
at d.i.m.e.diagram.runtime//org.eclipse.elk.alg.layered.p3order.LayerSweepTypeDecider.useBottomUp(LayerSweepTypeDecider.java:113)
at d.i.m.e.diagram.runtime//org.eclipse.elk.alg.layered.p3order.GraphInfoHolder.<init>(GraphInfoHolder.java:117)
at d.i.m.e.diagram.runtime//org.eclipse.elk.alg.layered.p3order.LayerSweepCrossingMinimizer.initialize(LayerSweepCrossingMinimizer.java:604)
at d.i.m.e.diagram.runtime//org.eclipse.elk.alg.layered.p3order.LayerSweepCrossingMinimizer.process(LayerSweepCrossingMinimizer.java:122)
at d.i.m.e.diagram.runtime//org.eclipse.elk.alg.layered.p3order.LayerSweepCrossingMinimizer.process(LayerSweepCrossingMinimizer.java:1)
at d.i.m.e.diagram.runtime//org.eclipse.elk.alg.layered.ElkLayered.hierarchicalLayout(ElkLayered.java:269)
at d.i.m.e.diagram.runtime//org.eclipse.elk.alg.layered.ElkLayered.doCompoundLayout(ElkLayered.java:186)
at d.i.m.e.diagram.runtime//org.eclipse.elk.alg.layered.LayeredLayoutProvider.layout(LayeredLayoutProvider.java:53)
at d.i.m.e.diagram.runtime//org.eclipse.elk.core.RecursiveGraphLayoutEngine.executeAlgorithm(RecursiveGraphLayoutEngine.java:443)
at d.i.m.e.diagram.runtime//org.eclipse.elk.core.RecursiveGraphLayoutEngine.layoutRecursively(RecursiveGraphLayoutEngine.java:410)
at d.i.m.e.diagram.runtime//org.eclipse.elk.core.RecursiveGraphLayoutEngine.layout(RecursiveGraphLayoutEngine.java:104)
at d.i.m.e.diagram.runtime//org.eclipse.elk.core.RecursiveGraphLayoutEngine.layout(RecursiveGraphLayoutEngine.java:80)
at d.i.m.e.diagram.runtime//de.itemis.mps.editor.diagram.runtime.jgraph.ElkLayouter.layoutOnce(ElkLayouter.java:301)
at d.i.m.e.diagram.runtime//de.itemis.mps.editor.diagram.runtime.jgraph.ElkLayouter.layout(ElkLayouter.java:254)
@alexanderpann alexanderpann added the bug Erroneous behaviour. label Oct 31, 2024
@soerendomroes
Copy link
Contributor

Could you provide me with an example graph in elklive?

This might happen since the greedy switch heuristic also calls the layer sweep. But I cannot say for sure since I do not have an example to debug.

@soerendomroes
Copy link
Contributor

Unfortunately, I can share any reproducible example.

Oh my bad, this is probably a typo and you cannot share your model. Should you list the layout options that you set? Some are not made to be used together with INCLUDE_CHILDREN. Especially everything that somehow influences order other than portConstraints.

@alexanderpann
Copy link
Author

alexanderpann commented Dec 3, 2024

Sorry for the delay and I meant that I can't share the model. Most of them are probably the default values but they are populated automatically, so I can't tell you which one we changed:
Diagram

  • org.eclipse.elk.algorithm -> org.eclipse.elk.layered
  • org.eclipse.elk.hierarchyHandling -> INCLUDE_CHILDREN
  • org.eclipse.elk.edgeRouting -> ORTHOGONAL
  • org.eclipse.elk.padding -> [top=12.0,left=12.0,bottom=12.0,right=12.0]
  • org.eclipse.elk.interactive -> false
  • org.eclipse.elk.interactiveLayout -> false
  • org.eclipse.elk.topdown.hierarchicalNodeAspectRatio -> 1.414
  • org.eclipse.elk.topdown.hierarchicalNodeWidth -> 150.0
  • org.eclipse.elk.topdownLayout -> false,
  • org.eclipse.elk.topdown.scaleCap -> 1.0
  • org.eclipse.elk.spacing.portsSurrounding -> [top=10.0,left=10.0,bottom=10.0,right=10.0]
  • org.eclipse.elk.layered.unnecessaryBendpoints -> true, org.eclipse.elk.layered.wrapping.additionalEdgeSpacing -> 10.0
  • org.eclipse.elk.layered.nodePlacement.bk.edgeStraightening -> IMPROVE_STRAIGHTNESS
  • org.eclipse.elk.layered.nodePlacement.bk.fixedAlignment -> NONE
  • org.eclipse.elk.spacing.commentComment -> 10.0
  • org.eclipse.elk.spacing.componentComponent -> 20.0
  • org.eclipse.elk.layered.compaction.connectedComponents -> false
  • org.eclipse.elk.layered.considerModelOrder.strategy -> NONE
  • org.eclipse.elk.layered.considerModelOrder.components -> NONE
  • org.eclipse.elk.layered.considerModelOrder.portModelOrder -> false
  • org.eclipse.elk.contentAlignment -> [V_TOP, H_LEFT]
  • org.eclipse.elk.layered.wrapping.correctionFactor -> 1.0
  • org.eclipse.elk.layered.considerModelOrder.crossingCounterNodeInfluence -> 0.0
  • org.eclipse.elk.layered.considerModelOrder.crossingCounterPortInfluence -> 0.0
  • org.eclipse.elk.layered.crossingMinimization.strategy -> LAYER_SWEEP
  • org.eclipse.elk.layered.wrapping.cutting.strategy -> MSD,
  • org.eclipse.elk.layered.cycleBreaking.strategy -> GREEDY
  • org.eclipse.elk.direction -> RIGHT
  • org.eclipse.elk.layered.directionCongruency -> READING_DIRECTION
  • org.eclipse.elk.layered.wrapping.multiEdge.distancePenalty -> 2.0
  • org.eclipse.elk.layered.edgeLabels.centerLabelPlacementStrategy -> MEDIAN_LAYER
  • org.eclipse.elk.layered.spacing.edgeEdgeBetweenLayers -> 20.0
  • org.eclipse.elk.layered.edgeLabels.sideSelection -> SMART_DOWN
  • org.eclipse.elk.spacing.edgeLabel -> 10.0
  • org.eclipse.elk.layered.spacing.edgeNodeBetweenLayers -> 20.0
  • org.eclipse.elk.spacing.edgeNode -> 20.0
  • org.eclipse.elk.spacing.edgeEdge -> 20.0
  • org.eclipse.elk.edge.thickness -> 1.0
  • org.eclipse.elk.layered.feedbackEdges -> false
  • org.eclipse.elk.nodeSize.fixedGraphSize -> false
  • org.eclipse.elk.layered.crossingMinimization.forceNodeModelOrder -> false
  • org.eclipse.elk.layered.generatePositionAndLayerIds -> false
  • org.eclipse.elk.layered.wrapping.strategy -> OFF
  • org.eclipse.elk.layered.crossingMinimization.greedySwitch.activationThreshold -> 40
  • org.eclipse.elk.layered.crossingMinimization.greedySwitch.type -> TWO_SIDED
  • org.eclipse.elk.layered.crossingMinimization.greedySwitchHierarchical.type -> OFF
  • org.eclipse.elk.layered.crossingMinimization.hierarchicalSweepiness -> 0.1
  • org.eclipse.elk.layered.highDegreeNodes.treeHeight -> 5
  • org.eclipse.elk.layered.highDegreeNodes.threshold -> 16
  • org.eclipse.elk.layered.highDegreeNodes.treatment -> false
  • org.eclipse.elk.spacing.labelPortHorizontal -> 1.0
  • org.eclipse.elk.layered.wrapping.multiEdge.improveCuts -> true
  • org.eclipse.elk.layered.wrapping.multiEdge.improveWrappedEdges -> true
  • org.eclipse.elk.layered.interactiveReferencePoint -> CENTER
  • org.eclipse.elk.spacing.labelNode -> 5.0
  • org.eclipse.elk.spacing.labelLabel -> 0.0
  • org.eclipse.elk.layered.layering.coffmanGraham.layerBound -> 2147483647
  • org.eclipse.elk.partitioning.activate -> false
  • org.eclipse.elk.layered.nodePlacement.linearSegments.deflectionDampening -> 0.3
  • org.eclipse.elk.layered.considerModelOrder.longEdgeStrategy -> DUMMY_NODE_OVER
  • org.eclipse.elk.layered.layering.nodePromotion.maxIterations -> 0
  • org.eclipse.elk.layered.mergeEdges -> false
  • org.eclipse.elk.layered.mergeHierarchyEdges -> true
  • org.eclipse.elk.layered.wrapping.cutting.msd.freedom -> 1
  • org.eclipse.elk.layered.nodePlacement.networkSimplex.nodeFlexibility.default -> NONE
  • org.eclipse.elk.nodeLabels.padding -> [top=5.0,left=5.0,bottom=5.0,right=5.0]
  • org.eclipse.elk.layered.layering.strategy -> NETWORK_SIMPLEX
  • org.eclipse.elk.layered.spacing.nodeNodeBetweenLayers -> 20.0
  • org.eclipse.elk.layered.nodePlacement.strategy -> BRANDES_KOEPF
  • org.eclipse.elk.layered.layering.nodePromotion.strategy -> NONE
  • org.eclipse.elk.spacing.nodeSelfLoop -> 10.0
  • org.eclipse.elk.spacing.nodeNode -> 20.0
  • org.eclipse.elk.layered.portSortingStrategy -> INPUT_ORDER
  • org.eclipse.elk.spacing.portPort -> 20.0
  • org.eclipse.elk.layered.compaction.postCompaction.constraints -> SCANLINE
  • org.eclipse.elk.layered.compaction.postCompaction.strategy -> NONE
  • org.eclipse.elk.randomSeed -> 1, org.eclipse.elk.layered.crossingMinimization.semiInteractive -> false
  • org.eclipse.elk.layered.edgeRouting.polyline.slopedEdgeZoneWidth -> 2.0
  • org.eclipse.elk.layered.edgeRouting.splines.sloppy.layerSpacingFactor -> 0.2
  • org.eclipse.elk.layered.spacing.baseValue -> 0.0
  • org.eclipse.elk.layered.edgeRouting.splines.mode -> SLOPPY
  • org.eclipse.elk.layered.thoroughness -> 7
  • org.eclipse.elk.topdown.scaleFactor -> 1.0
  • org.eclipse.elk.layered.layering.minWidth.upperBoundOnWidth -> 4 org.eclipse.elk.layered.layering.minWidth.upperLayerEstimationScalingFactor -> 2 org.eclipse.elk.layered.wrapping.validify.strategy -> GREEDY

Nodes

  • org.eclipse.elk.portConstraints -> FIXED_SIDE
  • org.eclipse.elk.spacing.portPort -> 10.0
  • org.eclipse.elk.nodeSize.constraints -> [PORTS, MINIMUM_SIZE]
  • org.eclipse.elk.nodeSize.options -> [DEFAULT_MINIMUM_SIZE]
  • org.eclipse.elk.padding -> [top=12.0,left=12.0,bottom=12.0,right=12.0]
  • org.eclipse.elk.nodeLabels.placement -> []
  • org.eclipse.elk.portLabels.placement -> [OUTSIDE]
  • org.eclipse.elk.insideSelfLoops.activate -> false
  • org.eclipse.elk.alignment -> AUTOMATIC
  • org.eclipse.elk.commentBox -> false
  • org.eclipse.elk.hierarchyHandling -> INHERIT
  • org.eclipse.elk.hypernode -> false
  • org.eclipse.elk.margins -> [top=0.0,left=0.0,bottom=0.0,right=0.0]
  • org.eclipse.elk.noLayout -> false
  • org.eclipse.elk.topdown.hierarchicalNodeAspectRatio -> 1.414
  • org.eclipse.elk.topdown.hierarchicalNodeWidth -> 150.0
  • org.eclipse.elk.layered.layering.layerConstraint -> NONE
  • org.eclipse.elk.layered.considerModelOrder.noModelOrder -> false]

Edges

  • org.eclipse.elk.insideSelfLoops.yo -> false
  • org.eclipse.elk.edge.thickness -> 1.0
  • org.eclipse.elk.noLayout -> false
  • org.eclipse.elk.edge.type -> NONE
  • org.eclipse.elk.font.size -> 1
  • org.eclipse.elk.layered.priority.direction -> 0
  • org.eclipse.elk.layered.priority.shortness -> 0
  • org.eclipse.elk.layered.priority.straightness -> 0
  • org.eclipse.elk.layered.edgeRouting.selfLoopDistribution -> NORTH

@soerendomroes
Copy link
Contributor

So if I see that correctly, you only set INCLUDE_CHILDREN on the parent and set portConstraints and nodeSize constraints on each node. Everything else is a default value? If you know of any non-default value it this might help to identify the issue. To me FIXED_SIDE portConstraints make no sense since there do not seem to be any ports, or are they?
Maybe you could roughly sketch how the graph looks like be editing and sharing this example.

I do not have any idea why this happened. If you find a small example that you could share, it would be much appreciated. I would only be interested in the graph structure, everything else does not matter. If you run ELK in Eclipse, maybe you could export the layout graph as detailed here in the Log Configuration section.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Erroneous behaviour.
Projects
None yet
Development

No branches or pull requests

2 participants