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: README.md
+8-2Lines changed: 8 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -53,10 +53,10 @@ Here we are going to synthetically illustrate some of the main features of Multi
53
53
Let's begin by importing the necessary dependencies and setting the relevant constants.
54
54
55
55
```julia
56
+
# Import necessary dependencies
56
57
using Distributions, Graphs, SimpleValueGraphs
57
58
using MultilayerGraphs
58
-
59
-
# Set the number of nodes: objects represented by multilayer vertices
59
+
# Set the number of nodes
60
60
const n_nodes =100
61
61
# Create a list of nodes
62
62
const node_list = [Node("node_$i") for i in1:n_nodes]
@@ -69,6 +69,7 @@ We will instantiate layers and interlayers with randomly-selected edges and vert
69
69
Here we define a layer with an underlying simple directed graph using a graph generator-like (or "configuration model"-like) constructor which allows us to specify both the **indegree** and the **outdegree sequences**. Before instantiating each layer we sample the number of its vertices and, optionally, of its edges.
Then we define a layer with an underlying simple weighted directed graph. This is another kind of constructor that allows the user to specify the number of edges to be randomly distributed among vertices.
82
83
83
84
```julia
85
+
# Create a simple directed weighted layer
84
86
n_vertices =rand(1:n_nodes) # Number of vertices
85
87
n_edges =rand(n_vertices:(n_vertices * (n_vertices -1) -1)) # Number of edges
Similar constructors, more flexible at the cost of ease of use, enable a finer tuning. The constructor we use below should be necessary only in rare circumstances, e.g. if the equivalent simplified constructor `layer_simplevaldigraph` is not able to infer the correct return types of `default_vertex_metadata` or `default_edge_metadata`, or to use and underlying graph structure that isn't currently supported.
95
97
96
98
```julia
99
+
# Create a simple directed value layer
97
100
n_vertices =rand(1:n_nodes) # Number of vertices
98
101
n_edges =rand(n_vertices:(n_vertices * (n_vertices -1) -1)) # Number of edges
99
102
default_vertex_metadata = v -> ("vertex_$(v)_metadata") # Vertex metadata
@@ -125,6 +128,7 @@ The interface of interlayers is very similar to that of layers. It is very impor
125
128
Here we define an interlayer with an underlying simple directed graph.
126
129
127
130
```julia
131
+
# Create a simple directed interlayer
128
132
n_vertices_1 =nv(layer_simple_directed) # Number of vertices of layer 1
129
133
n_vertices_2 =nv(layer_simple_directed_weighted) # Number of vertices of layer 2
130
134
n_edges =rand(1:(n_vertices_1 * n_vertices_2 -1)) # Number of interlayer edges
0 commit comments