Skip to content

Commit 9c61bc4

Browse files
committed
improve docs
1 parent 45329b9 commit 9c61bc4

File tree

3 files changed

+14
-9
lines changed

3 files changed

+14
-9
lines changed

docs/src/index.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,15 @@ nothing #hide
1919

2020
# Basic Usage & Algorithms
2121
All of the algorithms follow the [Layout Interface](@ref). Each layout algorithm
22-
is represented by a type `Algorithm <: AbstractLayout`. The parameters of each
23-
algorithm can be set with keyword arguments. The `Algorithm` object itself is
22+
is represented by a type `LayoutAlgorithm <: AbstractLayout`. The parameters of each
23+
layout can be set with keyword arguments. The `LayoutAlgorithm` object itself is
2424
callable and transforms the adjacency matrix and returns a list of `Point{N,T}` from [`GeometryBasics.jl`](https://github.com/JuliaGeometry/GeometryBasics.jl).
2525

2626
```
27-
alg = Algorithm(; p1="foo", p2=:bar)
27+
alg = LayoutAlgorithm(; p1="foo", p2=:bar)
2828
positions = alg(adj_matrix)
2929
```
30+
Instead of using the adjacency matrix you can use `AbstractGraph` types from [`LightGraphs.jl`](https://github.com/JuliaGraphs/LightGraphs.jl) directly.
3031

3132
## Scalable Force Directed Placement
3233
```@docs

docs/src/interface.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,21 @@ CurrentModule = NetworkLayout
66

77
At its core, each layout algorithm is a mapping
88
```
9-
adj_matrix ↦ node_positions
9+
graph ↦ node_positions
1010
```
11-
where each algorithm has several parameters. The main goal of the following interface is to keep the separation between parameters and function call.
12-
Each Algorithm is implemented as subtype of [`AbstractLayout`](@ref).
11+
where each layout has several parameters. The main goal of the following interface is to keep the separation between parameters and function call.
12+
Each layout is implemented as subtype of [`AbstractLayout`](@ref).
1313

1414
```@docs
1515
AbstractLayout
1616
```
1717

18-
Therefore, each `Algorithm <: AbstractLayout` is a functor and can be passed around as a function `adj_matrix ↦ node_positions` which encapsulates all the parameters. This is handy for plotting libraries such as [GraphMakie.jl](http://juliaplots.org/GraphMakie.jl/previews/PR9/).
18+
Therefore, each `Layout <: AbstractLayout` is a functor and can be passed around as a function `graph ↦ node_positions` which encapsulates all the parameters. This is handy for plotting libraries such as [GraphMakie.jl](http://juliaplots.org/GraphMakie.jl/previews/PR9/).
1919

2020
There are some additional guidelines:
2121
- All of the parameters should be keyword arguments, i.e. it should be allways
22-
possible to call `Algorithm()` without specifying any parameters.
23-
- Algorithms should allways return `Vector{Point{dim,Ptype}}`. If the type or
22+
possible to call `Layout()` without specifying any parameters.
23+
- Algorithms should allways return `Vector{Point{Dim,Ptype}}`. If the type or
2424
dimensions can be altered use the keywords `dim` and `Ptype` for it.
2525
- Some parameters may depend on the specific network (i.e. length of start
2626
positions vector). If possible, there should be a fallback option (i.e.

src/NetworkLayout.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ implement
1818
which takes the adjacency matrix representation of a network and returns a list of
1919
node positions. Each `Layout` object holds all of the necessary parameters.
2020
21+
The type parameters specify the returntype `Vector{Point{Dim,Ptype}}`:
22+
- `Dim`: the dimensionality of the layout (i.e. 2 or 3)
23+
- `Ptype`: the type of the returned points (i.e. `Float32` or `Float64`)
24+
2125
By implementing `layout` the Layout also inherits the function-like property
2226
2327
Layout(; kwargs...)(adj_matrix) -> node_positions

0 commit comments

Comments
 (0)