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.

Flaw in LayoutSubviews/TopologicalSort

See original GitHub issue

Hello,

I just realized that the code in LayoutSubviews that collects the dependencies is incomplete:

                        foreach (var v in InternalSubviews) {
                                nodes.Add (v);
                                if (v.LayoutStyle == LayoutStyle.Computed) {
                                        if (v.X is Pos.PosView vX)
                                                edges.Add ((vX.Target, v));
                                        if (v.Y is Pos.PosView vY)
                                                edges.Add ((vY.Target, v));
                                        if (v.Width is Dim.DimView vWidth)
                                                edges.Add ((vWidth.Target, v));
                                        if (v.Height is Dim.DimView vHeight)
                                                edges.Add ((vHeight.Target, v));
                                }
                        }

The issue is that this is not taking into account the Dim and Pos subclasses that combine two views, so we only do the proper job of topologically sorting when there is a direct dependency, not when there is something like view + 1 (when we create a combined pos/dim)

The code needs to handle PosCombine/DimCombine and recursively add the elements to it.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
migueldeicazacommented, Apr 16, 2021

Beautiful!

0reactions
BDispcommented, Apr 1, 2021
Read more comments on GitHub >

github_iconTop Results From Across the Web

Is this topological sort in Ruby flawed?
The method tsort takes as input a vertex item and an array dependencies_array holding the dependencies of item (meaning the vertices that have ......
Read more >
Topological Sorting
Topological sorting for Directed Acyclic Graph (DAG) is a linear ordering of vertices such that for every directed edge u v, vertex u...
Read more >
Graph based problem(specifically topological sort)
Graph based problem(specifically topological sort). I have done around 150 questions in leetcode which includes most important subtopics.
Read more >
Topological sorting and NP-hard proof
I meet a problem. I can find a sub-optimal solution, but cannot find an optimal one and cannot prove its NPC hardness. The...
Read more >
ds.algorithms - Positive topological ordering
5 Answers 5 · The problem is invariant under the transformation of reversing the partial ordering and negating all the weights. · But...
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