Skip to content

Commit 459da4f

Browse files
InterdisciplinaryPhysicsTeamClaudMorpitmonticone
committed
Update README.md
Co-Authored-By: Claudio Moroni <[email protected]> Co-Authored-By: Pietro Monticone <[email protected]>
1 parent 117f251 commit 459da4f

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@ Here we are going to synthetically illustrate some of the main features of Multi
5353
Let's begin by importing the necessary dependencies and setting the relevant constants.
5454

5555
```julia
56+
# Import necessary dependencies
5657
using Distributions, Graphs, SimpleValueGraphs
5758
using MultilayerGraphs
58-
59-
# Set the number of nodes: objects represented by multilayer vertices
59+
# Set the number of nodes
6060
const n_nodes = 100
6161
# Create a list of nodes
6262
const node_list = [Node("node_$i") for i in 1:n_nodes]
@@ -69,6 +69,7 @@ We will instantiate layers and interlayers with randomly-selected edges and vert
6969
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.
7070

7171
```julia
72+
# Create a simple directed layer
7273
n_vertices = rand(1:100) # Number of vertices
7374
layer_simple_directed = layer_simpledigraph( # Layer constructor
7475
:layer_simple_directed, # Layer name
@@ -81,6 +82,7 @@ layer_simple_directed = layer_simpledigraph( # Layer constructor
8182
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.
8283

8384
```julia
85+
# Create a simple directed weighted layer
8486
n_vertices = rand(1:n_nodes) # Number of vertices
8587
n_edges = rand(n_vertices:(n_vertices * (n_vertices - 1) - 1)) # Number of edges
8688
layer_simple_directed_weighted = layer_simpleweighteddigraph( # Layer constructor
@@ -94,6 +96,7 @@ layer_simple_directed_weighted = layer_simpleweighteddigraph( # Layer construct
9496
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.
9597

9698
```julia
99+
# Create a simple directed value layer
97100
n_vertices = rand(1:n_nodes) # Number of vertices
98101
n_edges = rand(n_vertices:(n_vertices * (n_vertices - 1) - 1)) # Number of edges
99102
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
125128
Here we define an interlayer with an underlying simple directed graph.
126129

127130
```julia
131+
# Create a simple directed interlayer
128132
n_vertices_1 = nv(layer_simple_directed) # Number of vertices of layer 1
129133
n_vertices_2 = nv(layer_simple_directed_weighted) # Number of vertices of layer 2
130134
n_edges = rand(1:(n_vertices_1 * n_vertices_2 - 1)) # Number of interlayer edges
@@ -138,6 +142,7 @@ interlayer_simple_directed = interlayer_simpledigraph( # Interlayer constructor
138142
The interlayer exports a more flexible constructor too.
139143

140144
```julia
145+
# Create a simple directed meta interlayer
141146
n_vertices_1 = nv(layer_simple_directed_weighted) # Number of vertices of layer 1
142147
n_vertices_2 = nv(layer_simple_directed_value) # Number of vertices of layer 2
143148
n_edges = rand(1:(n_vertices_1 * n_vertices_2 - 1)) # Number of interlayer edges
@@ -159,6 +164,7 @@ interlayers = [interlayer_simple_directed, interlayer_simple_directed_meta]
159164
Let's construct a directed multilayer graph (`MultilayerDiGraph`).
160165

161166
```julia
167+
# Create a simple directed multilayer graph
162168
multilayerdigraph = MultilayerDiGraph( # Constructor
163169
layers, # The (ordered) collection of layers
164170
interlayers; # The manually specified interlayers

0 commit comments

Comments
 (0)