You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/src/network_construction.md
+18-8Lines changed: 18 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
3
3
## Building a Network
4
4
The main type of `NetworkDynamics.jl` is a [`Network`](@ref).
5
-
A network bundles various component models (edge and vertex models) together with a graph to form a callable object which represents the right hand side (RHS) of the overall dynamical system, see [Mathematical Model](@ref).
5
+
A network bundles various component models (edge and vertex models) together with a graph to form a callable object which represents the right hand side (RHS) of the overall dynamical system, see [Mathematical Model](@ref).
6
6
7
7
A `Network` is build by passing a graph `g`, vertex models `vertexm` and edge models `edgem` to the [`Network`](@ref) constructor:.
Two important keywords for the [`Network`](@ref) constructor are:
13
13
14
-
-`execution`:
14
+
-`execution`:
15
15
Defines the [`ExecutionStyle`](@ref) of the coreloop, e.g. `SequentialExecution{true}()`.
16
-
A execution style is a special Julia object, which tells the backend how to parallelize (e.g. `ThreadedExecution{true}()` will use native Julia threads to parallelize the RHS call).
16
+
A execution style is a special Julia object, which tells the backend how to parallelize (e.g. `ThreadedExecution{true}()` will use native Julia threads to parallelize the RHS call).
17
17
A list of available executions styles can be found under [Execution Types](@ref) in the API.
18
18
19
19
-`aggregator`:
20
20
Instructs the backend how to perform the aggregation and which aggregation function to use.
21
21
Aggregation is the process of creating a single vertex input by reducing over the outputs of adjecent edges of said vertex. The `aggregator` contains both the function and the algorithm. E.g. `SequentialAggregator(+)` is a sequential aggregation by summation. A list of availabe Aggregators can be found under [`Aggregators`](@ref) in the API.
22
22
23
+
### Graphless Constructor
24
+
If each of the network components has a "graphelement" [metadata](@ref Metadata), we may omit the explicit graph.
25
+
```julia
26
+
nw =Network(vertexm, edgem)
27
+
```
28
+
The graphelement metadata can be set using the following syntax:
29
+
```julia
30
+
VertexModel(; ..., vidx=1) # places vertex at position 1
31
+
EdgeModel(; ..., src=1, dst=2) # places edge between 1 and 2
32
+
EdgeModel(; ..., src=:v1, dst=:v2) # places edge between vertices with names `:v1` and `:v2`
33
+
```
34
+
23
35
## Building `VertexModel`s
24
36
This chapter will walk you through the most important aspects of defining a custom vertex model. For a list of all keyword arguments please check out the docstring of [`VertexModel`](@ref).
25
37
26
-
As an example, we'll construct an second order kuramoto model, because that is what the package does.
38
+
As an example, we'll construct an second order kuramoto model.
27
39
```@example construction
28
40
using NetworkDynamics #hide
29
41
function kuramoto_f!(dv, v, esum, p, t)
@@ -65,7 +77,7 @@ Lastly, we define improved names for our states and parameters as well as assign
65
77
Whenever you provide a `sym` keyword the corresponding `dim` keyword stops being neccessary. So, we end up with a relatively short definition
0 commit comments