Skip to content

Commit a719662

Browse files
author
unknown
committed
intermediate state
1 parent 2f02a6e commit a719662

File tree

2 files changed

+44
-36
lines changed

2 files changed

+44
-36
lines changed

docs/src/index.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,11 @@ between the [Graphs.jl](https://github.com/JuliaGraphs/Graphs.jl) and the
66
highly efficient dynamic networks by describing the local dynamics on the edges and vertices of the network graph.
77

88
!!! note
9-
** Complex Networks in a glance **
9+
**Complex Networks in a glance**
1010
Complex network systems are composed by the entities that comprise them (the nodes) and the relationships that connect
1111
each entity with one another (the edges). The mathematical structure (used more or less interchangeably with
1212
Network) is called [Graph](https://en.wikipedia.org/wiki/Graph_theory). The graphical depictions of such
1313
networks are also called graphs. You will see both usages in this guide.
14-
A network (which can be seen in the figure below) is composed of nodes (v1 to v5) who are connected to each other.
15-
The lines connecting the nodes with each other ( e1: 1-->2, e2: 1-->3, e3: 2-->3, e4: 2-->4, e5: 3-->5) are called
16-
edges. Complex networks are composed of multiple nodes and edges, with most nodes connected to multiple other nodes
17-
with multiple edges
1814

1915
```@example
2016
using Graphs, GraphMakie, CairoMakie #hide
@@ -30,6 +26,11 @@ hidespines!(ax) #hide
3026
hidedecorations!(ax) #hide
3127
fig #hide
3228
```
29+
Figure 1: A network (which can be seen in the figure below) is composed of nodes (v1 to v5) who are connected to each
30+
other. The lines connecting the nodes with each other ( e1: 1-->2, e2: 1-->3, e3: 2-->3, e4: 2-->4, e5: 3-->5) are called
31+
edges. Complex networks are composed of multiple nodes and edges, with most nodes connected to multiple other nodes
32+
with multiple edges
33+
3334
(@Hans after rereading the text I realised that the information about the core of the package and the behaviours of the
3435
nodes and edges does not belong in the introduction but rather in the mathematical model, so I moved it. If you are ok)
3536
with this just delete this comment)

docs/src/mathematical_model.md

Lines changed: 38 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@ nd(dx, x, p, t)
1010
```
1111

1212
The local dynamics on the edges and nodes of the graph can be described through the use of (a) algebraic equations,
13-
(b) differential algebraic equation (DAEs) in mass matrix form or (c) ordinary differential equations (ODE). The
14-
`NetworkDynamics.jl` package uses [Differential-Algebraic-Equation (DAE)](https://mathworld.wolfram.com/Differential-AlgebraicEquation.html)
13+
(b) differential algebraic equation (DAEs) in mass matrix form or (c) ordinary differential equations (ODE).
14+
15+
The `NetworkDynamics.jl` package uses
16+
[Differential-Algebraic-Equation (DAE)](https://mathworld.wolfram.com/Differential-AlgebraicEquation.html)
1517
to express the overall network dynamics:
1618
```math
1719
M\,\frac{\mathrm{d}}{\mathrm{d}t}u = f^{\mathrm{nw}}(u, p, t)
@@ -33,39 +35,42 @@ y^{\mathrm c} &= g^{\mathrm c}(x^\mathrm{c}, i_{\mathrm c}, p_{\mathrm c}, t)
3335
\end{aligned}
3436
```
3537
where $M_{\mathrm{c}}$ is the component mass matrix, $x^{\mathrm c}$ are the component states, $i^{\mathrm c}$ are the
36-
***inputs*** of the component and $y^{\mathrm c}$ is the ***output*** of the component. If
38+
inputs of the component and $y^{\mathrm c}$ is the output of the component. If
3739
$\mathrm{dim}(x^{\mathrm{c}}) = 0$, the number of internal states is 0.
3840

3941
The mathematical model of `NetworkDynamics.jl` splits the network system in two parts: the vertex and
4042
the edge components (the nodes and edges, respectively). Instead of defining the $f^{\mathrm{nw}}$ by hand, `ND.jl`
41-
builds it automatically based on a list of decentralized nodal and edge dynamics that you need to provide,
42-
the so-called `VertexModel` and `EdgeModel` objects.
43+
builds it automatically based on a list of decentralized nodal and edge dynamics that the user provides (
44+
the so-called `VertexModel` and `EdgeModel` objects).
4345

4446
In the context of the network, the **output of the edges are flow variables** and the **outputs of vertices are
45-
potential variables**. When the node and edge models are placed on a graph, the inputs and outputs ware connected:
46-
the nodes receive the output of the adjacent edges as inputs and the edges receive the output of the adjecent nodes as
47-
inputs.
48-
49-
Thus, the *flow* on the edges depends on the *potentials* at both ends as inputs. The *potentials* of the nodes depend on the
50-
incoming *flows* from all connected edges as an input. (Here, flow and potentials are meant in a conceptional and not
51-
necessarily physical way.)
47+
potential variables**. When the node and edge models are placed on a graph, the inputs and outputs are connected:
48+
the nodes receive the output of the adjacent edges as inputs and the edges receive the output of the adjacent nodes as
49+
inputs. Thus, the *flow* on the edges depends on the *potentials* at both ends as inputs. The *potentials* of the nodes
50+
depend on the incoming *flows* from all connected edges as an input. (Here, flow and potentials are meant in a
51+
conceptional and not necessarily physical way.)
5252

5353
```@raw html
54-
<img src="../assets/mathmodel.svg" width="100%"/>
54+
<img src="../assets/mathmodel.svg" width="100% height="100%"/>
5555
```
56-
57-
56+
Figure 2: Here part of a network is shown. Three nodes are visible (node1, node 2 and node3) as well as the edges
57+
connecting node1 and node2 ($e_12$, $e_21$). Above the network, the mass matrix equations on node1 and node2
58+
($M_{\mathrm{c}}x^{\mathrm c}$), the equations on the connecting edges ($e_12$, $e_21$), as well as the internal
59+
state vector equations of node1 and node2($u_1$ and $u_2$) are also shown.
60+
(@Hans: this graphic looks black with dark letter for the most part in some browsers. It may be a better idea to add
61+
a white background to it)
5862

5963
## Vertex Models
60-
```@raw html
61-
<img src="../assets/nodemodel.svg" width="100%"/>
62-
```
6364
A (single-layer) vertex model has one input, and one output.
64-
The input is an aggregation/reduction over all of the *incident edge outputs*,
65+
The input is an aggregation/reduction over all of the *incident edge outputs*:
6566
```math
6667
i^{\mathrm v} = \mathop{\mathrm{agg}}\limits_k^{\text{incident}} y^{\mathrm e}_k \qquad\text{often}\qquad
6768
i^{\mathrm v} = \sum_k^{\text{incident}} y^{\mathrm e}_k
6869
```
70+
```@raw html
71+
<img src="../assets/nodemodel.svg" width="100% style="red"/>
72+
```
73+
6974
The full vertex model
7075
```math
7176
\begin{aligned}
@@ -87,23 +92,25 @@ vertf = VertexModel(; f=fᵥ, g=gᵥ, mass_matrix=Mᵥ, ...)
8792
```
8893

8994
## Edge Models
90-
```@raw html
91-
<img src="../assets/edgemodel.svg" width="100%"/>
92-
```
93-
In contrast to vertex models, edge models in general have *two* inputs and *two* outputs, for both the source and the
94-
destination end of the edge. We commonly use `src` and `dst` to describe the source and destination end of an edge
95-
respectively.
95+
In contrast to vertex models, edge models in general have *two* inputs and *two* outputs, for both the source and the
96+
destination end of the edge. We commonly use `src` and `dst` to describe the source and destination end of an edge,
97+
respectively.
98+
99+
The *inputs* of the edge are the outputs of the two nodes at both their ends. The output is split into two parts:
100+
the `dst` output goes to the input of the vertex at the destination end, the `src` output goes to the input of the
101+
vertex at the `src` end.
102+
103+
For undirected graphs, `Graphs.jl` chooses the direction of an edge `v1->v2` such that `v1 < v2`, i.e. the edge between
104+
vertices 16 and 12 will be always an edge with source `src=12` and destination `dst=16`.
96105

97106
!!! note "On the directionality of edges"
98107
Mathematically, in a system defined on an undirected graph there is no difference between edge $(1,2)$ and
99108
edge $(2,1)$, because the edge has no direction. However, from an implementation point of view we always need to have
100109
some kind of ordering, which is why we introduce the source and destination terminology.
101110

102-
For undirected graphs, `Graphs.jl` chooses the direction of an edge `v1->v2` such that `v1 < v2`, i.e. the edge between vertices 16 and 12 will be always and edge with `src=12` and `dst=16`.
103-
104-
The *inputs* of the edge are the outputs of the two nodes at both their ends. The output is split into two parts:
105-
the `dst` output goes to the input of the vertex at the destination end, the `src` output goes to the input of the
106-
vertex at the `src` end.
111+
```@raw html
112+
<img src="../assets/edgemodel.svg" width="100%"/>
113+
```
107114

108115
The full model of an edge
109116
```math
@@ -128,7 +135,7 @@ vertf = EdgeModel(; f=fₑ, g=gₑ, mass_matrix=Mₑ, ...)
128135

129136
The sign convention for both outputs of an edge must be identical, so typically, a positive flow represents a flow
130137
*into* the connected vertex. This is important, because the vertex only receives the flows, it does not know whether
131-
the flow was produce by the source or the destination end of an edge.
138+
the flow was produced by the source or the destination end of an edge.
132139
```
133140
y_src y_dst
134141
V_src o───←─────────→───o V_dst

0 commit comments

Comments
 (0)