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
* Add `temporal_rand_radius_graph` function
* New version
* Add test for `temporal_rand_radius_graph`
* Update on a square with border
* Add docstring
* Export `temporal_rand_radius_graph`
* Add more spaces
Co-authored-by: Carlo Lucibello <[email protected]>
* Improved docstring
Co-authored-by: Carlo Lucibello <[email protected]>
* Rename
* Add ref
---------
Co-authored-by: Carlo Lucibello <[email protected]>
@@ -298,3 +300,65 @@ function radius_graph(points::AbstractMatrix, r::AbstractFloat;
298
300
end
299
301
return g
300
302
end
303
+
304
+
"""
305
+
rand_temporal_radius_graph(number_nodes::Int,
306
+
number_snapshots::Int,
307
+
speed::AbstractFloat,
308
+
r::AbstractFloat;
309
+
self_loops = false,
310
+
dir = :in,
311
+
kws...)
312
+
313
+
Create a random temporal graph given `number_nodes` nodes and `number_snapshots` snapshots.
314
+
First, the positions of the nodes are randomly generated in the unit square. Two nodes are connected if their distance is less than a given radius `r`.
315
+
Each following snapshot is obtained by applying the same construction to new positions obtained as follows.
316
+
For each snapshot, the new positions of the points are determined by applying random independent displacement vectors to the previous positions. The direction of the displacement is chosen uniformly at random and its length is chosen uniformly in `[0, speed]`. Then the connections are recomputed.
317
+
If a point happens to move outside the boundary, its position is updated as if it had bounced off the boundary.
318
+
319
+
# Arguments
320
+
321
+
- `number_nodes`: The number of nodes of each snapshot.
322
+
- `number_snapshots`: The number of snapshots.
323
+
- `speed`: The speed to update the nodes.
324
+
- `r`: The radius of connection.
325
+
- `self_loops`: If `true`, consider the node itself among its neighbors, in which
326
+
case the graph will contain self-loops.
327
+
- `dir`: The direction of the edges. If `dir=:in` edges go from the
328
+
neighbors to the central node. If `dir=:out` we have the opposite
329
+
direction.
330
+
- `kws`: Further keyword arguments will be passed to the [`GNNGraph`](@ref) constructor of each snapshot.
331
+
332
+
# Example
333
+
334
+
```julia-repl
335
+
julia> n, snaps, s, r = 10, 5, 0.1, 1.5;
336
+
337
+
julia> tg = rand_temporal_radius_graph(n,snaps,s,r) # complete graph at each snapshot
0 commit comments