Przeglądaj źródła

Changes inlining behaviour in TrimTree

If we are deleting a node N, if the edge between N and its parent and
the edge between N and its child are both inline, then the resulting
residual edge from N's parent and the child will also be inline.
Wade Simba Khadder 9 lat temu
rodzic
commit
a6e308c932
1 zmienionych plików z 6 dodań i 3 usunięć
  1. 6
    3
      internal/graph/graph.go

+ 6
- 3
internal/graph/graph.go Wyświetl plik

18
 import (
18
 import (
19
 	"fmt"
19
 	"fmt"
20
 	"math"
20
 	"math"
21
-	"os"
22
 	"path/filepath"
21
 	"path/filepath"
23
 	"sort"
22
 	"sort"
24
 	"errors"
23
 	"errors"
370
 			parent = edge.Src
369
 			parent = edge.Src
371
 		}
370
 		}
372
 
371
 
372
+		parentEdgeInline := parent.Out[cur].Inline
373
+
373
 		// Remove the edge from the parent to this node
374
 		// Remove the edge from the parent to this node
374
 		delete(parent.Out, cur)
375
 		delete(parent.Out, cur)
375
 
376
 
383
 
384
 
384
 			outEdge.Src = parent
385
 			outEdge.Src = parent
385
 			outEdge.Residual = true
386
 			outEdge.Residual = true
386
-			// Any reconfigured edge can no longer be Inline.
387
-			outEdge.Inline = false
387
+			// If the edge from the parent to the current node and the edge from the
388
+			// current node to the child are both inline, then this resulting residual
389
+			// edge should also be inline
390
+			outEdge.Inline = parentEdgeInline && outEdge.Inline
388
 		}
391
 		}
389
 	}
392
 	}
390
 	g.RemoveRedundantEdges()
393
 	g.RemoveRedundantEdges()