question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Interpreting edge label position

See original GitHub issue

Hi,

Please consider the following Klay JSON:

{
    "id": "root",
    "labels": [
        {
            "text": "root"
        }
    ],
    "edges": [
        {
            "id": "off_on",
            "source": "off",
            "target": "on",
            "labels": [
                {
                    "text": "touch",
                    "width": 10.140625,
                    "height": 5
                }
            ]
        },
        {
            "id": "on_off",
            "source": "on",
            "target": "off",
            "labels": [
                {
                    "text": "touch",
                    "width": 10.140625,
                    "height": 5
                }
            ]
        }
    ],
    "width": 10,
    "height": 10,
    "children": [
        {
            "id": "off",
            "labels": [
                {
                    "text": "off"
                }
            ],
            "edges": [],
            "width": 10,
            "height": 10
        },
        {
            "id": "on",
            "labels": [
                {
                    "text": "on"
                }
            ],
            "edges": [],
            "width": 10,
            "height": 10
        }
    ]
}

When layout is applied, this yields the following kgraph:

{
    "id": "root",
    "labels": [
        {
            "text": "root"
        }
    ],
    "edges": [
        {
            "id": "off_on",
            "source": "off",
            "target": "on",
            "labels": [
                {
                    "text": "touch",
                    "width": 10.140625,
                    "height": 5,
                    "x": 37.99999952316284,
                    "y": 0
                }
            ],
            "sourcePoint": {
                "x": 88.14062404632568,
                "y": 24
            },
            "targetPoint": {
                "x": 22,
                "y": 24
            },
            "junctionPoints": []
        },
        {
            "id": "on_off",
            "source": "on",
            "target": "off",
            "labels": [
                {
                    "text": "touch",
                    "width": 10.140625,
                    "height": 5,
                    "x": 37.99999952316284,
                    "y": 16
                }
            ],
            "sourcePoint": {
                "x": 22,
                "y": 27.333333333333332
            },
            "targetPoint": {
                "x": 88.14062404632568,
                "y": 27.333333333333336
            },
            "bendPoints": [
                {
                    "x": 35.99999976158142,
                    "y": 27.333333333333332
                },
                {
                    "x": 35.99999976158142,
                    "y": 40
                },
                {
                    "x": 74.14062428474426,
                    "y": 40
                },
                {
                    "x": 74.14062428474426,
                    "y": 27.333333333333336
                }
            ],
            "junctionPoints": []
        }
    ],
    "width": 110.14062404632568,
    "height": 53,
    "children": [
        {
            "id": "off",
            "labels": [
                {
                    "text": "off"
                }
            ],
            "edges": [],
            "width": 10,
            "height": 10,
            "x": 88.14062404632568,
            "y": 20.666666666666668,
            "$H": 26
        },
        {
            "id": "on",
            "labels": [
                {
                    "text": "on"
                }
            ],
            "edges": [],
            "width": 10,
            "height": 10,
            "x": 12,
            "y": 20.666666666666664,
            "$H": 27
        }
    ],
    "$H": 1
}

I was wondering if you could guide me as to how to interpret the x and y values of the edge labels.

When both edge labels are interpreted as being in the coordinate space (sharing the offset of) node “on”, then this renders beautifully:

screen shot 2016-04-12 at 12 12 14 am

However it is unclear to me how to characterize the general relationship between these edge coordinates and node “on”. For example, edge “on_off” has a relationship with “on” such that “on” is the source of “on_off”. But this is not true of edge “off_on” - in this case node “on” is the target.

I would appreciate any guidance you can offer on how to interpret these coordinates. Thank you.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
uruurucommented, Apr 12, 2016

Looks like a bug in the position application code. I’ll look into it. Thanks for mentioning the issue.

0reactions
jbeard4commented, Apr 14, 2016

I opened a related issue here: #9. Thank you.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Edge Label Placement Demo - yFiles for HTML
This demo shows how to place edge labels at the preferred location with a labeling algorithm and the PreferredPlacementDescriptor type.
Read more >
On the complexity of the Edge Label Placement problem
We consider the problem of positioning text or symbol labels corresponding to edges of G, called the Edge Label Placement (ELP) problem. The...
Read more >
Edge Attributes | Graphviz
head_lp – Center position of an edge's head label. For write only. headclip – If true, the head of an edge is clipped...
Read more >
Adjust edge label position in mediation diagram with ...
The bottom edge label is not centered and the two angled edge labels are positioned at different heights (see the red lines in...
Read more >
EdgeLabels - Wolfram Language Documentation
EdgeLabels is an option and annotation for Graph and related functions that specifies what labels and label positions should be used for edges....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found