https://github.com/loov/layout
Graph layouting package
https://github.com/loov/layout
wip
Last synced: 3 months ago
JSON representation
Graph layouting package
- Host: GitHub
- URL: https://github.com/loov/layout
- Owner: loov
- License: mit
- Created: 2017-08-23T15:50:38.000Z (almost 8 years ago)
- Default Branch: main
- Last Pushed: 2025-01-28T11:53:54.000Z (5 months ago)
- Last Synced: 2025-03-30T02:41:29.096Z (3 months ago)
- Topics: wip
- Language: Go
- Size: 151 KB
- Stars: 24
- Watchers: 4
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# layout [](https://godoc.org/github.com/loov/layout) [](https://goreportcard.com/report/github.com/loov/layout)
## Experimental
Current version and API is in experimental stage. Property names may change.
## Installation
The graph layouting can be used as a command-line tool and as a library.
To install the command-line tool:
```
go get -u github.com/loov/layout/cmd/glay
```To install the package:
```
go get -u github.com/loov/layout
```## Usage
Minimal usage:
```
package mainimport (
"os""github.com/loov/layout"
"github.com/loov/layout/format/svg"
)func main() {
graph := layout.NewDigraph()
graph.Edge("A", "B")
graph.Edge("A", "C")
graph.Edge("B", "D")
graph.Edge("C", "D")layout.Hierarchical(graph)
svg.Write(os.Stdout, graph)
}
```
See other examples in `examples` folder.
## Quality
Currently the `layout.Hierarchy` algorithm output is significantly worse than graphviz. It is recommended to use `graphviz dot`, if possible.