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
Next, we explore the API associated to modify and analyze `Layer`s and `Interlayer`s. A complete list of methods relating to subgraphs can be found [here](@ref subgraphs_eu).
302
+
Next, we explore the API associated to modify and analyze `Layer`s and `Interlayer`s.
The [`vertices(subgraph::AbstractSubGraph)`](@ref) command would return an internal representation of the `MultilayerVertex`s. This method, together with others, serves to make `MultilayerGraphs.jl` compatible with the Graphs.jl ecosystem, but it is not meant to be called by the end user. It is, anyway, thought to be used by developers who wish to interface their packages with `MultilayerGraphs.jl` just as with other packages of the `Graphs.jl` ecosystem: as said above, a developer-oriented guide will be compiled if there is the need, although docstrings are already completed.
405
405
406
-
To add a vertex, simply use [`add_vertex!(layer::Layer, mv::MultilayerVertex)`](@ref). Let us define a vertex with metadata to add. Since nodes may not be represented more than once in layers, we have to define a new node too:
406
+
To add a vertex, simply use `add_vertex!`. Let us define a vertex with metadata to add. Since nodes may not be represented more than once in layers, we have to define a new node too:
- 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:
430
430
1. They may be more convenient;
431
-
1. They should work even if we are not able to integrate the *standard* and the *uniform* interface with a particular `Graphs.jl`'s extension.
431
+
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.
If an underlying graph has an `add_vertex!` interface whose signature overlaps with that of the uniform interface, the uniform interface will be prevail.
@@ -447,15 +447,16 @@ If, using the *transparent* interface, one does not specify any `metadata`, the
447
447
To remove the vertex, simply do:
448
448
```julia
449
449
rem_vertex!(layer_sg, new_vertex) # Returns true if succeeds
450
-
```s
450
+
```
451
+
451
452
To extract metadata:
452
453
```julia
453
454
get_metadata(layer_mg, MV(new_node))
454
455
```
455
456
456
457
By design, one may not add nor remove vertices to `Interlayer`s.
457
458
458
-
Please refer to the Vertex section of the API page ([end-user]() and [developer]()) to discover more methods related to `MultilayerVertex`s.
459
+
A complete list of methods relating to subgraphs can be found [here](@ref subgraphs_eu).
Where `ME` is a shorthand for `MultilayerEdge`. Besides the two vertices connected, each `MultilayerEdge` carries the information about its `weight` and `metadata`. For unweighted subgraphs, the weight is just `one(weighttype)` and for non-meta subgraphs the metadata are an empty `NamedTuple`s. See `?MultilayerEdge` for additional information.
490
+
Where `ME` is a shorthand for `MultilayerEdge`. Besides the two vertices connected, each `MultilayerEdge` carries the information about its `weight` and `metadata`. For unweighted subgraphs, the weight is just `one(weighttype)` and for non-meta subgraphs the metadata are an empty `NamedTuple`s. See `?MultilayerEdge` for additional information, or refer to the [Edges](@ref edges_eu) to discover more methods related to `MultilayerEdges`s.
490
491
491
492
The `add_edge` function has the standard, uniform and transparent interfaces too. To understand how they work, let's define a weighted edge:
If an underlying graph has an `add_edge!` interface whose signature overlaps with that of the uniform interface, the uniform interface will prevail.
530
531
531
-
If, using the *transparent* interface, one does not specify any `weight` or (inclusively) `metadata` keyword argument, the `default_edge_weight` or (inclusively) the `default_edge_metadata` function passed to the `Layer`'s constructor will be called to provide `weight` or `metadata` to the edge (type `?Layer` in the REPL for more information).
532
+
If, using the *transparent* interface, one does not specify any `weight` or (inclusively) `metadata` keyword argument, the `default_edge_weight` or (inclusively) the `default_edge_metadata` function passed to the subgraph's constructor will be called to provide `weight` or `metadata` to the edge (type `?Layer` in the REPL for more information).
532
533
533
534
To remove the edge, simply do:
534
535
```julia
@@ -575,8 +576,6 @@ To extract metadata:
575
576
get_metadata(layer_mg, src_m, dst_m)
576
577
```
577
578
578
-
Please refer to the Vertex section of the API page ([end-user]() and [developer]()) to discover more methods related to `MultilayerEdges`s.
579
-
580
579
For the `layer_swg`, the following three signatures would be equivalent:
581
580
582
581
-*standard* interface:
@@ -600,8 +599,6 @@ The edge may be removed via
600
599
rem_edge!(layer_swg, src_w, dst_w)
601
600
```
602
601
603
-
Please refer to the `MultilayerEdge` section of the API page ([end-user]() and [developer]()) to discover more methods related to `MultilayerEdge`s.
604
-
605
602
### Multilayer Graphs
606
603
607
604
Given all the `Layer`s and the `Interlayer`s, let's instantiate a multilayer graph as follows:
Keep in mind that `Multilayer(Di)Graph` only supports uniform and standard interface for both `add_vertex!` and `add_edge!`.
614
+
**Keep in mind that `Multilayer(Di)Graph` only supports uniform and standard interface for both `add_vertex!` and `add_edge!`.**
618
615
619
616
As already stated, a `MultilayerGraph` is an object made of `Layer`s and `Interlayer`s whose collections of vertices each represents a subset of the set of nodes, here being `nodes`.
620
617
@@ -626,7 +623,8 @@ It is used as:
626
623
627
624
628
625
```julia
629
-
# First, we need to empty the above layers and interlayers, and remove the ones having a `SimpleWeightedGraph`s. These lines are not necessary to comprehend the tutorial, they may be skipped. Just know that the variables `empty_layers` and `empty_interlayers` are two lists of. respectively, empty layers and interlayers that do not have `SimpleWeightedGraph`s as their underlying graphs
626
+
# The configuration model-like constructor will be responsible for creating the edges, so we need to provide it with empty layers and interlayers.
627
+
# To create empty layers and interlayers, we will empty the above subgraphs, and, for compatobility reasons, we'll remove the ones having a `SimpleWeightedGraph`s. These lines are not necessary to comprehend the tutorial, they may be skipped. Just know that the variables `empty_layers` and `empty_interlayers` are two lists of, respectively, empty layers and interlayers that do not have `SimpleWeightedGraph`s as their underlying graphs
630
628
631
629
empty_layers =deepcopy([layer for layer in layers if!(layer.graph isa SimpleWeightedGraphs.AbstractSimpleWeightedGraph)])
Note that this is not an implementation of a fully-fledged configuration model, which would require to be able to specify a degree distribution for every dimension of multiplexity. Please refer to [#future-developments]().
651
+
Note that this is not an implementation of a fully-fledged configuration model, which would require to be able to specify a degree distribution for every dimension of multiplexity. Please refer to [Future Developments](@ref).
658
652
659
653
There is a similar constructor for `MultilayerDiGraph` which requires both the indegree distribution and the outdegree distribution. Anyway due to current performance limitations in the graph realization algorithms, it is suggested to provide two "similar" distributions (similar mean or location parameter, similar variance or shape parameter), in order not to incur in lengthy computational times.
660
654
@@ -675,7 +669,6 @@ Now one may add vertices that represent that node, e.g.:
675
669
```julia
676
670
new_vertex =MV(new_node, :layer_sg)
677
671
add_vertex!(multilayergraph, new_vertex)
678
-
rem_vertex!(multilayergraph, new_vertex) # hide
679
672
```
680
673
```nothing
681
674
true
@@ -829,7 +822,6 @@ Note that `wgt` is an object of type [`WeightTensor`](@ref). You may access its
829
822
830
823
```julia
831
824
array(wgt)
832
-
; # hide
833
825
```
834
826
835
827
Also, you may index it using `MultilayerVertex`s:
@@ -851,7 +843,7 @@ The package also exports a [`SupraWeightMatrix`](@ref) which is a supra (weighte
851
843
852
844
#### Multilayer-specific analytical tools
853
845
854
-
Read a complete list of analytical methods exclusive to multilayer graphs in the dedicated [API section](@refAPI) (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.
846
+
Read a complete list of analytical methods exclusive to multilayer graphs in the dedicated [API section](@refmsm_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.
0 commit comments