elk icon indicating copy to clipboard operation
elk copied to clipboard

Placement of edge labels wrong using Stress and Force layout

Open Eddykasp opened this issue 3 years ago • 2 comments

The expected behaviour is that edge labels are placed somewhere along their edges. Instead some are shifted seemingly arbitrarily.

Example Graph (Stress)

elk_stress_edge_labels

Example Graph (Force)

In this example some edge labels are missing because they are shifted so far that they leave the graph area completely. elk_force_edge_labels

Example Graph Code (kgt)

properties:
    org.eclipse.elk.algorithm=stress

knode PLOE {
    kedge (-> NST) {
        klabel "39"
    }
    kedge (->HL) {
        klabel "49"
    }
    kedge (->NMS) {
        klabel "37"
    }
    kedge (->BS) {
        klabel "40"
    }
}
knode KI {
    kedge (-> NMS) {
        klabel "35"
    }
    kedge (-> RD) {
        klabel "39"
    }
    kedge (-> ECK) {
        klabel "29"
    }
    kedge (-> PLOE) {
        klabel "32"
    }
}
knode NMS {
    kedge (-> IZ) {
        klabel "40"
    }
    kedge (-> BS) {
        klabel "31"
    }

}
knode ECK {

}
knode RD {
    kedge (->SL) {
        klabel "38"
    }
    kedge (->NMS) {
        klabel "41"
    }
}
knode SL {
    kedge (-> ECK) {
        klabel "26"
    }
}
knode NST {
    kedge (-> HL) {
        klabel "36"
    }
}
knode HL {

}
knode BS {
    kedge (-> HL) {
        klabel "28"
    }
}
knode IZ {
    
}

Eddykasp avatar Jun 21 '22 08:06 Eddykasp

Can you provide the corresponding graph in elkt or elkg format that reproduces this issue?

soerendomroes avatar Jun 21 '22 10:06 soerendomroes

this is for the version using force

layout [ size: 80, 80 ]
algorithm: force
nodeSize.constraints: "[]"
aspectRatio: 1.43
nodeLabels.placement: "[H_CENTER, V_TOP, INSIDE]"
node PLOE {
  layout [ size: 80, 80 ]
  nodeSize.minimum: "(80.0,80.0)"
  elk.padding: "[top=12.0,left=12.0,bottom=12.0,right=12.0]"
  nodeSize.constraints: "[]"
  nodeLabels.placement: "[H_CENTER, V_CENTER, INSIDE]"
  de.cau.cs.kieler.klighd.minimalNodeSize: "(80.0,80.0)"
  label "PLOE" {
    layout [ size: 27, 13 ]
  }
}
node KI {
  layout [ size: 80, 80 ]
  nodeSize.minimum: "(80.0,80.0)"
  elk.padding: "[top=12.0,left=12.0,bottom=12.0,right=12.0]"
  nodeSize.constraints: "[]"
  nodeLabels.placement: "[H_CENTER, V_CENTER, INSIDE]"
  de.cau.cs.kieler.klighd.minimalNodeSize: "(80.0,80.0)"
  label "KI" {
    layout [ size: 10, 13 ]
  }
}
node NMS {
  layout [ size: 80, 80 ]
  nodeSize.minimum: "(80.0,80.0)"
  elk.padding: "[top=12.0,left=12.0,bottom=12.0,right=12.0]"
  nodeSize.constraints: "[]"
  nodeLabels.placement: "[H_CENTER, V_CENTER, INSIDE]"
  de.cau.cs.kieler.klighd.minimalNodeSize: "(80.0,80.0)"
  label "NMS" {
    layout [ size: 24, 13 ]
  }
}
node ECK {
  layout [ size: 80, 80 ]
  nodeSize.minimum: "(80.0,80.0)"
  elk.padding: "[top=12.0,left=12.0,bottom=12.0,right=12.0]"
  nodeSize.constraints: "[]"
  nodeLabels.placement: "[H_CENTER, V_CENTER, INSIDE]"
  de.cau.cs.kieler.klighd.minimalNodeSize: "(80.0,80.0)"
  label "ECK" {
    layout [ size: 21, 13 ]
  }
}
node RD {
  layout [ size: 80, 80 ]
  nodeSize.minimum: "(80.0,80.0)"
  elk.padding: "[top=12.0,left=12.0,bottom=12.0,right=12.0]"
  nodeSize.constraints: "[]"
  nodeLabels.placement: "[H_CENTER, V_CENTER, INSIDE]"
  de.cau.cs.kieler.klighd.minimalNodeSize: "(80.0,80.0)"
  label "RD" {
    layout [ size: 15, 13 ]
  }
}
node SL {
  layout [ size: 80, 80 ]
  nodeSize.minimum: "(80.0,80.0)"
  elk.padding: "[top=12.0,left=12.0,bottom=12.0,right=12.0]"
  nodeSize.constraints: "[]"
  nodeLabels.placement: "[H_CENTER, V_CENTER, INSIDE]"
  de.cau.cs.kieler.klighd.minimalNodeSize: "(80.0,80.0)"
  label "SL" {
    layout [ size: 13, 13 ]
  }
}
node NST {
  layout [ size: 80, 80 ]
  nodeSize.minimum: "(80.0,80.0)"
  elk.padding: "[top=12.0,left=12.0,bottom=12.0,right=12.0]"
  nodeSize.constraints: "[]"
  nodeLabels.placement: "[H_CENTER, V_CENTER, INSIDE]"
  de.cau.cs.kieler.klighd.minimalNodeSize: "(80.0,80.0)"
  label "NST" {
    layout [ size: 22, 13 ]
  }
}
node HL {
  layout [ size: 80, 80 ]
  nodeSize.minimum: "(80.0,80.0)"
  elk.padding: "[top=12.0,left=12.0,bottom=12.0,right=12.0]"
  nodeSize.constraints: "[]"
  nodeLabels.placement: "[H_CENTER, V_CENTER, INSIDE]"
  de.cau.cs.kieler.klighd.minimalNodeSize: "(80.0,80.0)"
  label "HL" {
    layout [ size: 14, 13 ]
  }
}
node BS {
  layout [ size: 80, 80 ]
  nodeSize.minimum: "(80.0,80.0)"
  elk.padding: "[top=12.0,left=12.0,bottom=12.0,right=12.0]"
  nodeSize.constraints: "[]"
  nodeLabels.placement: "[H_CENTER, V_CENTER, INSIDE]"
  de.cau.cs.kieler.klighd.minimalNodeSize: "(80.0,80.0)"
  label "BS" {
    layout [ size: 14, 13 ]
  }
}
node IZ {
  layout [ size: 80, 80 ]
  nodeSize.minimum: "(80.0,80.0)"
  elk.padding: "[top=12.0,left=12.0,bottom=12.0,right=12.0]"
  nodeSize.constraints: "[]"
  nodeLabels.placement: "[H_CENTER, V_CENTER, INSIDE]"
  de.cau.cs.kieler.klighd.minimalNodeSize: "(80.0,80.0)"
  label "IZ" {
    layout [ size: 10, 13 ]
  }
}
edge PLOE -> NST {
  layout [
  ]
  junctionPoints: "()"
  label "39" {
    layout [ size: 14, 13 ]
    font.name: SansSerif
    org.eclipse.elk.font.^size: 8
  }
}
edge PLOE -> HL {
  layout [
  ]
  junctionPoints: "()"
  label "49" {
    layout [ size: 14, 13 ]
    font.name: SansSerif
    org.eclipse.elk.font.^size: 8
  }
}
edge PLOE -> NMS {
  layout [
  ]
  junctionPoints: "()"
  label "37" {
    layout [ size: 14, 13 ]
    font.name: SansSerif
    org.eclipse.elk.font.^size: 8
  }
}
edge PLOE -> BS {
  layout [
  ]
  junctionPoints: "()"
  label "40" {
    layout [ size: 14, 13 ]
    font.name: SansSerif
    org.eclipse.elk.font.^size: 8
  }
}
edge KI -> NMS {
  layout [
  ]
  junctionPoints: "()"
  label "35" {
    layout [ size: 14, 13 ]
    font.name: SansSerif
    org.eclipse.elk.font.^size: 8
  }
}
edge KI -> RD {
  layout [
  ]
  junctionPoints: "()"
  label "39" {
    layout [ size: 14, 13 ]
    font.name: SansSerif
    org.eclipse.elk.font.^size: 8
  }
}
edge KI -> ECK {
  layout [
  ]
  junctionPoints: "()"
  label "29" {
    layout [ size: 14, 13 ]
    font.name: SansSerif
    org.eclipse.elk.font.^size: 8
  }
}
edge KI -> PLOE {
  layout [
  ]
  junctionPoints: "()"
  label "32" {
    layout [ size: 14, 13 ]
    font.name: SansSerif
    org.eclipse.elk.font.^size: 8
  }
}
edge NMS -> IZ {
  layout [
  ]
  junctionPoints: "()"
  label "40" {
    layout [ size: 14, 13 ]
    font.name: SansSerif
    org.eclipse.elk.font.^size: 8
  }
}
edge NMS -> BS {
  layout [
  ]
  junctionPoints: "()"
  label "31" {
    layout [ size: 14, 13 ]
    font.name: SansSerif
    org.eclipse.elk.font.^size: 8
  }
}
edge RD -> SL {
  layout [
  ]
  junctionPoints: "()"
  label "38" {
    layout [ size: 14, 13 ]
    font.name: SansSerif
    org.eclipse.elk.font.^size: 8
  }
}
edge RD -> NMS {
  layout [
  ]
  junctionPoints: "()"
  label "41" {
    layout [ size: 14, 13 ]
    font.name: SansSerif
    org.eclipse.elk.font.^size: 8
  }
}
edge SL -> ECK {
  layout [
  ]
  junctionPoints: "()"
  label "26" {
    layout [ size: 14, 13 ]
    font.name: SansSerif
    org.eclipse.elk.font.^size: 8
  }
}
edge NST -> HL {
  layout [
  ]
  junctionPoints: "()"
  label "36" {
    layout [ size: 14, 13 ]
    font.name: SansSerif
    org.eclipse.elk.font.^size: 8
  }
}
edge BS -> HL {
  layout [
  ]
  junctionPoints: "()"
  label "28" {
    layout [ size: 14, 13 ]
    font.name: SansSerif
    org.eclipse.elk.font.^size: 8
  }
}

Eddykasp avatar Jun 21 '22 10:06 Eddykasp