Flaw in LayoutSubviews/TopologicalSort
See original GitHub issueHello,
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:
- Created 3 years ago
- Comments:6
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Beautiful!
I think I just fix it now with this commit https://github.com/migueldeicaza/gui.cs/pull/1161/commits/0511a51b700b4bf098a323424720440e5332e098