Skip to content

Commit 3998302

Browse files
2 parents f7c6f17 + 82605b6 commit 3998302

File tree

1 file changed

+56
-55
lines changed

1 file changed

+56
-55
lines changed

docs/src/index.md

Lines changed: 56 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ Printing a `MultilayerVertex` returns:
104104
```julia
105105
multilayervertices_meta[1]
106106
```
107-
```nothing
107+
```nothing
108108
MV(Node("node_1"), :nothing, ("I'm node node_1",))
109109
```
110110

@@ -166,33 +166,33 @@ We are now are ready to define some `Layer`s. Every type of graph from the Graph
166166
_nv, _ne = rand_nv_ne_layer(min_vertices,max_vertices)
167167
layer_sg = Layer( :layer_sg,
168168
sample(multilayervertices, _nv, replace = false),
169-
_ne,
169+
_ne,
170170
SimpleGraph{vertextype}(),
171171
_weighttype
172172
)
173173

174174
# A weighted `Layer`
175175
_nv, _ne = rand_nv_ne_layer(min_vertices,max_vertices)
176-
layer_swg = Layer( :layer_swg,
176+
layer_swg = Layer( :layer_swg,
177177
sample(multilayervertices, _nv, replace = false),
178-
_ne,
178+
_ne,
179179
SimpleWeightedGraph{vertextype, _weighttype}(),
180-
_weighttype;
180+
_weighttype;
181181
default_edge_weight = (src,dst) -> rand()
182182
)
183-
# A `Layer` with an underlying `MetaGraph`:
183+
# A `Layer` with an underlying `MetaGraph`:
184184
_nv, _ne = rand_nv_ne_layer(min_vertices,max_vertices)
185-
layer_mg = Layer( :layer_mg,
186-
sample(multilayervertices_meta, _nv, replace = false),
187-
_ne,
185+
layer_mg = Layer( :layer_mg,
186+
sample(multilayervertices_meta, _nv, replace = false),
187+
_ne,
188188
MetaGraph{vertextype, _weighttype}(),
189-
_weighttype;
189+
_weighttype;
190190
default_edge_metadata = (src,dst) -> (from_to = "from_$(src)_to_$(dst)",)
191191
)
192192
# `Layer` with an underlying `ValGraph` from `SimpleValueGraphs.jl`
193193
_nv, _ne = rand_nv_ne_layer(min_vertices,max_vertices)
194-
layer_vg = Layer( :layer_vg,
195-
sample(multilayervertices_meta, _nv, replace = false),
194+
layer_vg = Layer( :layer_vg,
195+
sample(multilayervertices_meta, _nv, replace = false),
196196
_ne,
197197
MultilayerGraphs.ValGraph{vertextype}(;edgeval_types=(Float64, String, ),
198198
edgeval_init=(s, d) -> (s+d, "hi"),
@@ -253,7 +253,7 @@ Interlayer(
253253
default_edge_metadata::Function = (x,y) -> NamedTuple(), # Function that takes a pair of `MultilayerVertex`s and returns a `Tuple` or a `NamedTuple` containing the edge metadata, that will be called when `add_edge!(mg,src,dst, args...; kwargs...)` is called without the `metadata` keyword argument, and when generating the edges in this constructor. Defaults to `(src, dst) -> NamedTuple()`;
254254
name::Symbol = Symbol("interlayer_$(layer_1.name)_$(layer_2.name)"), # The name of the Interlayer. Defaults to Symbol("interlayer_(layer_1.name)_(layer_2.name)");
255255
transfer_vertex_metadata::Bool = false # if true, vertex metadata found in both connected layers are carried over to the vertices of the Interlayer. NB: not all choice of underlying graph may support this feature. Graphs types that don't support metadata or that pose limitations to it may result in errors.;
256-
)
256+
)
257257
```
258258
We will build a few of random `Interlayer`s:
259259

@@ -268,30 +268,30 @@ interlayer_sg_swg = Interlayer( layer_sg, # The first layer to
268268
)
269269
# Define a weighted `Interlayer`
270270
_ne = rand_ne_interlayer(layer_swg, layer_mg)
271-
interlayer_swg_mg = Interlayer( layer_swg,
271+
interlayer_swg_mg = Interlayer( layer_swg,
272272
layer_mg,
273273
_ne,
274-
SimpleWeightedGraph{vertextype, _weighttype}();
274+
SimpleWeightedGraph{vertextype, _weighttype}();
275275
default_edge_weight = (x,y) -> rand() # Arguments follow the same rules as in Layer
276-
)
276+
)
277277
# Define an `Interlayer` with an underlying `MetaGraph`
278278
_ne = rand_ne_interlayer(layer_mg, layer_vg)
279279
interlayer_mg_vg = Interlayer( layer_mg,
280-
layer_vg,
281-
_ne,
282-
MetaGraph{vertextype, _weighttype}();
283-
default_edge_metadata = (x,y) -> (mymetadata = rand(),),
280+
layer_vg,
281+
_ne,
282+
MetaGraph{vertextype, _weighttype}();
283+
default_edge_metadata = (x,y) -> (mymetadata = rand(),),
284284
transfer_vertex_metadata = true # This boolean kwarg controls whether vertex metadata found in both connected layers are carried over to the vertices of the Interlayer. NB: not all choice of underlying graph may support this feature. Graphs types that don't support metadata or that pose limitations to it may result in errors.
285285
)
286286
# Define an `Interlayer` with an underlying `ValGraph` from `SimpleValueGraphs.jl`, with diagonal couplings only:
287-
interlayer_multiplex_sg_mg = multiplex_interlayer( layer_sg,
288-
layer_mg,
289-
ValGraph{vertextype}(; edgeval_types=(from_to = String,), edgeval_init=(s, d) -> (from_to = "from_$(s)_to_$(d)"));
287+
interlayer_multiplex_sg_mg = multiplex_interlayer( layer_sg,
288+
layer_mg,
289+
ValGraph{vertextype}(; edgeval_types=(from_to = String,), edgeval_init=(s, d) -> (from_to = "from_$(s)_to_$(d)"));
290290
default_edge_metadata = (x,y) -> (from_to = "from_$(src)_to_$(dst)",)
291-
)
291+
)
292292
# Finally, An `Interlayer` with no couplings (an "empty" interlayer):
293-
interlayer_empty_sg_vg = empty_interlayer( layer_sg,
294-
layer_vg,
293+
interlayer_empty_sg_vg = empty_interlayer( layer_sg,
294+
layer_vg,
295295
SimpleGraph{vertextype}()
296296
)
297297

@@ -314,7 +314,7 @@ One may retrieve the `Node`s that a `Layer` represents via:
314314
```julia
315315
layer_sg_nodes = nodes(layer_sg)
316316
```
317-
```nothing
317+
```nothing
318318
6-element Vector{Node}:
319319
Node("node_2")
320320
Node("node_3")
@@ -329,7 +329,7 @@ The same would be for `Interlayer`s. In this case, the union of the set of nodes
329329
```julia
330330
interlayer_sg_swg_nodes = nodes(interlayer_sg_swg)
331331
```
332-
```nothing
332+
```nothing
333333
7-element Vector{Node}:
334334
Node("node_2")
335335
Node("node_3")
@@ -338,14 +338,14 @@ interlayer_sg_swg_nodes = nodes(interlayer_sg_swg)
338338
Node("node_5")
339339
Node("node_7")
340340
Node("node_1")
341-
```
341+
```
342342

343343
One may check for the existence of a node within a layer (or interlayer) via:
344344

345345
```julia
346346
has_node(layer_sg, layer_sg_nodes[1])
347347
```
348-
```nothing
348+
```nothing
349349
true
350350
```
351351

@@ -356,7 +356,7 @@ One may retrieve the `MultilayerVertex`s of a layer by calling:
356356
```julia
357357
layer_sg_vertices = mv_vertices(layer_sg)
358358
```
359-
```nothing
359+
```nothing
360360
6-element Vector{MultilayerVertex{:layer_sg}}:
361361
MV(Node("node_2"), :layer_sg, NamedTuple())
362362
MV(Node("node_3"), :layer_sg, NamedTuple())
@@ -371,7 +371,7 @@ While vertices with metadata would look like:
371371
```julia
372372
mv_vertices(layer_mg)
373373
```
374-
```nothing
374+
```nothing
375375
6-element Vector{MultilayerVertex{:layer_mg}}:
376376
MV(Node("node_7"), :layer_mg, (var"1" = "I'm node node_7",))
377377
MV(Node("node_6"), :layer_mg, (var"1" = "I'm node node_6",))
@@ -386,7 +386,7 @@ The vertices of an interlayer are the union of the sets of vertices of the two l
386386
```julia
387387
interlayer_sg_swg_vertices = mv_vertices(interlayer_sg_swg)
388388
```
389-
```nothing
389+
```nothing
390390
11-element Vector{MultilayerVertex}:
391391
MV(Node("node_2"), :layer_sg, NamedTuple())
392392
MV(Node("node_3"), :layer_sg, NamedTuple())
@@ -410,7 +410,7 @@ new_node = Node("missing_node")
410410
new_metadata = (meta = "my_metadata",)
411411
new_vertex = MV(new_node, new_metadata)
412412
```
413-
```nothing
413+
```nothing
414414
MV(Node("missing_node"), :nothing, (meta = "my_metadata",))
415415
```
416416

@@ -429,7 +429,7 @@ add_vertex!(layer_mg, new_node, metadata = new_metadata)
429429
- The *transparent* interface. After you pass to `add_vertex` the `Layer` and the `Node` you wish to add, you may pass the same `args` and `kwargs` that you would pass to the `add_vertex!` dispatch that acts on the underlying graph (after the graph argument). This is a way to let the user directly exploit the API of the underlying graph package, which could be useful for two reasons:
430430
1. They may be more convenient;
431431
2. They should work even if we are not able to integrate the *standard* and the *uniform* interface with a particular `Graphs.jl`'s extension.
432-
432+
433433
Here is an example on how to use it:
434434
```julia
435435
add_vertex!(layer_mg, new_node, Dict(pairs(new_metadata)))
@@ -464,7 +464,7 @@ The edge type for multilayer graphs (and thus for this subgraphs) is `Multilayer
464464
```julia
465465
edgetype(layer_sg)
466466
```
467-
```nothing
467+
```nothing
468468
MultilayerEdge{Float64}
469469
```
470470

@@ -551,7 +551,7 @@ _, src_m, dst_m = _get_srcmv_dstmv_layer(layer_mg)
551551
## Construct a MultilayerEdge with metadata
552552
me_m = ME(src_m, dst_m, _metadata)
553553
```
554-
```nothing
554+
```nothing
555555
ME(MV(Node("node_6"), :layer_mg, NamedTuple()) --> MV(Node("node_5"), :layer_mg, NamedTuple()), weight = nothing, metadata = (meta = "mymetadata",))
556556
```
557557

@@ -592,7 +592,7 @@ add_edge!(layer_swg, src_w, dst_w, _weight)
592592

593593
The uniform interface of `add_edge!` works so that the user may specify the keyword `weight` and/or the keyword `metadata`. If an underlying subgraph has a transparent interface whose signature overlaps with that of the uniform interface, the uniform interface will be prevail.
594594

595-
The edge may be removed via
595+
The edge may be removed via
596596

597597
```julia
598598
rem_edge!(layer_swg, src_w, dst_w)
@@ -671,7 +671,7 @@ Now one may add vertices that represent that node, e.g.:
671671
new_vertex = MV(new_node, :layer_sg)
672672
add_vertex!(multilayergraph, new_vertex)
673673
```
674-
```nothing
674+
```nothing
675675
true
676676
```
677677

@@ -680,7 +680,7 @@ And remove the node via `rem_node!`:
680680
```julia
681681
rem_node!(multilayergraph, new_node) # Return true if succeeds
682682
```
683-
```nothing
683+
```nothing
684684
true
685685
```
686686

@@ -703,7 +703,7 @@ true
703703
random_unweighted_edge = rand(collect(edges(multilayergraph.layer_sg)))
704704
set_weight!(multilayergraph, src(random_unweighted_edge), dst(random_unweighted_edge), rand())
705705
```
706-
```nothing
706+
```nothing
707707
false
708708
```
709709

@@ -717,7 +717,7 @@ One may of course add layers on the fly:
717717
_nv, _ne = rand_nv_ne_layer(min_vertices,max_vertices)
718718
new_layer = Layer( :new_layer,
719719
sample(multilayervertices, _nv, replace = false),
720-
_ne,
720+
_ne,
721721
SimpleGraph{vertextype}(),
722722
_weighttype
723723
)
@@ -733,7 +733,7 @@ add_layer!(
733733
# Check that the new layer now exists within the multilayer graph
734734
has_layer(multilayergraph, :new_layer)
735735
```
736-
```nothing
736+
```nothing
737737
true
738738
```
739739

@@ -742,7 +742,7 @@ The [`add_layer!`](@ref) function will automatically instantiate all the `Interl
742742
If you wish to manually specify an interlayer, just do:
743743

744744
```julia
745-
# Instantiate a new Interlayer. Notice that its name will be given by default as
745+
# Instantiate a new Interlayer. Notice that its name will be given by default as
746746
_ne = rand_ne_interlayer(layer_sg, new_layer)
747747
new_interlayer = Interlayer( layer_sg,
748748
new_layer,
@@ -764,7 +764,7 @@ true
764764
Suppose that, after some modifications of `multilayergraph`, you would like to inspect a particular slice (or subgraph) of it (i.e. a `Layer` or an `Interlayer`). You may use both layers and interlayers names as properties of the multilayer graph itself.
765765

766766
```julia
767-
# Get a layer by name
767+
# Get a layer by name
768768
multilayergraph.new_layer
769769
```
770770
```nothing
@@ -775,7 +775,7 @@ Layer{Int64, Float64, SimpleGraph{Int64}}(LayerDescriptor{Int64, Float64, Simple
775775
# Get an Interlayer by name
776776
multilayergraph.new_interlayer
777777
```
778-
```nothing
778+
```nothing
779779
Interlayer{Int64, Float64, SimpleGraph{Int64}}(InterlayerDescriptor{Int64, Float64, SimpleGraph{Int64}}(:new_interlayer, :layer_sg, :new_layer, SimpleGraph{Int64}(0, Vector{Int64}[]), MultilayerGraphs.var"#92#96"(), MultilayerGraphs.var"#93#97"(), false), SimpleGraph{Int64}(19, [[7, 12], [7, 8, 10, 11, 13], [7, 10], [7, 13], [7, 9, 11, 13], [7, 8, 12, 13], [1, 2, 3, 4, 5, 6], [2, 6], [5], [2, 3], [2, 5], [1, 6], [2, 4, 5, 6]]), Bijection{Int64,MultilayerVertex} (with 13 pairs))
780780
```
781781

@@ -785,7 +785,7 @@ Interlayer{Int64, Float64, SimpleGraph{Int64}}(InterlayerDescriptor{Int64, Float
785785
# Get an Interlayer from the names of the two layers that it connects
786786
get_interlayer(multilayergraph, :new_layer, :layer_sg )
787787
```
788-
```nothing
788+
```nothing
789789
Interlayer{Int64, Float64, SimpleGraph{Int64}}(InterlayerDescriptor{Int64, Float64, SimpleGraph{Int64}}(:new_interlayer_rev, :new_layer, :layer_sg, SimpleGraph{Int64}(0, Vector{Int64}[]), MultilayerGraphs.var"#92#96"(), MultilayerGraphs.var"#93#97"(), false), SimpleGraph{Int64}(19, [[8, 9, 10, 11, 12, 13], [9, 13], [12], [9, 10], [9, 12], [8, 13], [9, 11, 12, 13], [1, 6], [1, 2, 4, 5, 7], [1, 4], [1, 7], [1, 3, 5, 7], [1, 2, 6, 7]]), Bijection{Int64,MultilayerVertex} (with 13 pairs))
790790
```
791791

@@ -846,7 +846,8 @@ The package also exports a [`SupraWeightMatrix`](@ref) which is a supra (weighte
846846

847847
Read a complete list of analytical methods exclusive to multilayer graphs in the dedicated [API section](@ref msm_eu) (here "exclusive" means that wither those methods do not exists for standard graphs, or that they had to be reimplemented and so may present some caveats). Refer to their docstrings for more information.
848848

849-
#### Compatibility with Graphs.jl
849+
#### Compatibility with Agents.jl
850+
850851
`Multilayer(Di)Graph`s may be used as an argument to `GraphSpace` in [Agents.jl](https://github.com/JuliaDynamics/Agents.jl). A complete compatibility example may be found in [this test](https://github.com/JuliaGraphs/MultilayerGraphs.jl/blob/main/test/agents_jl_integration.jl).
851852

852853
### Future Developments
@@ -857,17 +858,17 @@ Read a complete list of analytical methods exclusive to multilayer graphs in the
857858
- [Implement projected monoplex and overlay graphs](https://github.com/JuliaGraphs/MultilayerGraphs.jl/issues/35);
858859
- [Implement more default multilayer graphs](https://github.com/JuliaGraphs/MultilayerGraphs.jl/issues/36) (e.g. multiplex graphs).
859860

860-
## How to Contribute
861+
## How to Contribute
861862

862-
The ongoing development of this package would greatly benefit from the valuable feedback of the esteemed members of the [JuliaGraph](https://github.com/orgs/JuliaGraphs/people) community, as well as from graph theorists, network scientists, and any users who may have general questions or suggestions.
863+
The ongoing development of this package would greatly benefit from the valuable feedback of the esteemed members of the [JuliaGraph](https://github.com/orgs/JuliaGraphs/people) community, as well as from graph theorists, network scientists, and any users who may have general questions or suggestions.
863864

864-
We therefore encourage you to participate in [discussions](https://github.com/JuliaGraphs/MultilayerGraphs.jl/discussions), raise [issues](https://github.com/JuliaGraphs/MultilayerGraphs.jl/issues), or submit [pull requests](https://github.com/JuliaGraphs/MultilayerGraphs.jl/pulls). Your contributions are most welcome!
865+
We therefore encourage you to participate in [discussions](https://github.com/JuliaGraphs/MultilayerGraphs.jl/discussions), raise [issues](https://github.com/JuliaGraphs/MultilayerGraphs.jl/issues), or submit [pull requests](https://github.com/JuliaGraphs/MultilayerGraphs.jl/pulls). Your contributions are most welcome!
865866

866867
## How to Cite
867868

868869
If you utilize this package in your project, please consider citing this repository using the citation information provided in [`CITATION.bib`](https://github.com/JuliaGraphs/MultilayerGraphs.jl/blob/main/CITATION.bib). This will help to give appropriate credit to the [contributors](https://github.com/JuliaGraphs/MultilayerGraphs.jl/graphs/contributors) and support the continued development of the package.
869870

870-
## Announcements
871+
## Announcements
871872

872873
The package and its features were announced on the following platforms:
873874

@@ -877,6 +878,6 @@ The package and its features were announced on the following platforms:
877878

878879
## References
879880

880-
1. De Domenico et al. (2013) [Mathematical Formulation of Multilayer Networks](https://doi.org/10.1103/PhysRevX.3.041022). *Physical Review X*;
881-
2. Kivelä et al. (2014) [Multilayer networks](https://doi.org/10.1093/comnet/cnu016). *Journal of Complex Networks*;
882-
3. Bianconi (2018) [Multilayer Networks: Structure and Function](https://global.oup.com/academic/product/multilayer-networks-9780192865540). *Oxford University Press*.
881+
1. De Domenico et al. (2013) [Mathematical Formulation of Multilayer Networks](https://doi.org/10.1103/PhysRevX.3.041022). *Physical Review X*;
882+
2. Kivelä et al. (2014) [Multilayer networks](https://doi.org/10.1093/comnet/cnu016). *Journal of Complex Networks*;
883+
3. Bianconi (2018) [Multilayer Networks: Structure and Function](https://global.oup.com/academic/product/multilayer-networks-9780192865540). *Oxford University Press*.

0 commit comments

Comments
 (0)