@@ -66,6 +66,32 @@ func main() {
66
66
}
67
67
```
68
68
69
+ ### Set node sizes
70
+
71
+ To set node sizes, you can use the functional options ` autog.WithNodeFixedSize ` :
72
+
73
+ ``` go
74
+ // all nodes have size 50x50
75
+ _ = autog.Layout (
76
+ src,
77
+ autog.WithNodeFixedSize (50.0 , 50.0 ),
78
+ )
79
+ ```
80
+ Or ` autog.WithNodeSize ` — this requires a mapping from node ids to their sizes:
81
+
82
+ ``` go
83
+ sizes := map [string ]graph.Size {
84
+ " N1" : {W: 60.0 , H: 40.0 },
85
+ " N2" : {W: 80.0 , H: 40.0 },
86
+ }
87
+
88
+ // nodes N1 and N2 will have the specified size
89
+ _ = autog.Layout (
90
+ src,
91
+ autog.WithNodeSize (sizes)
92
+ )
93
+ ```
94
+
69
95
## Overview
70
96
71
97
Hierarchical graph layout algorithms typically involve five primary phases, executed sequentially:
@@ -80,12 +106,11 @@ The autog pipeline runs default implementations for each of these phases.
80
106
However, it's possible to override individual defaults using functional options. For example:
81
107
82
108
``` go
83
- // import positioning "github.com/nulab/autog/phase4"
84
- autog.Layout (
85
- g,
86
- // override default phase4 implementation
87
- autog.WithPositioning (autog.PositioningVAlign ),
88
- )
109
+ autog.Layout (
110
+ g,
111
+ // override default phase4 implementation
112
+ autog.WithPositioning (autog.PositioningVAlign ),
113
+ )
89
114
```
90
115
You can also customize other algorithm parameters, such as max iterations and multiplying factors.
91
116
Refer to the documentation on the ` "github.com/nulab/autog/internal/graph".Params ` type for details on all configurable parameters or
0 commit comments