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
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -54,7 +54,9 @@ In the package documentation you can find a [tutorial](https://juliagraphs.org/M
54
54
-[ ][Implement more general configuration models / graph generators](https://github.com/JuliaGraphs/MultilayerGraphs.jl/issues/33);
55
55
-[ ][Implement graph of layers](https://github.com/JuliaGraphs/MultilayerGraphs.jl/issues/34);
56
56
-[ ][Implement projected monoplex and overlay graphs](https://github.com/JuliaGraphs/MultilayerGraphs.jl/issues/35);
57
-
-[ ][Implement more default multilayer graphs](https://github.com/JuliaGraphs/MultilayerGraphs.jl/issues/36) (e.g. multiplex graphs).
57
+
-[ ][Implement more default multilayer graphs](https://github.com/JuliaGraphs/MultilayerGraphs.jl/issues/36) (e.g. multiplex graphs);
58
+
-[ ][Implement configuration models / graph generators for interlayers](https://github.com/JuliaGraphs/MultilayerGraphs.jl/issues/46);
59
+
-[ ][Relax the requirement of same `T` and `U` for all `Layer`s and `Interlayer`s that are meant to constitute a `Multilayer(Di)Graph`](https://github.com/JuliaGraphs/MultilayerGraphs.jl/issues/53).
Copy file name to clipboardExpand all lines: docs/src/index.md
+41-27Lines changed: 41 additions & 27 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -128,19 +128,19 @@ As said before, to define a multilayer graph we need to specify its layers and i
128
128
129
129
```julia
130
130
Layer(
131
-
name::Symbol, # The name of the layer
132
-
vertices::Vector{ <: MultilayerVertex}, # The `MultilayerVertex`s of the Layer
133
-
ne::Int64, # The number of edges of the Layer
134
-
null_graph::G, # The Layer's underlying graph type, which must be passed as a null graph. If it is not, an error will be thrown.
135
-
weighttype::Type{U}; # The type of the `MultilayerEdge` weights (even when the underlying Layer's graph is unweighted, we need to specify a weight type since the `MultilayerGraph`s will always be weighted)
136
-
default_vertex_metadata::Function= mv ->NamedTuple(), # Function that takes a `MultilayerVertex` and returns a `Tuple` or a `NamedTuple` containing the vertex metadata. defaults to `mv -> NamedTuple()`;
137
-
default_edge_weight::Function= (src, dst) ->nothing, # Function that takes a pair of `MultilayerVertex`s and returns an edge weight of type `weighttype` or `nothing` (which is compatible with unweighted underlying graphs and corresponds to `one(weighttype)` for weighted underlying graphs). Defaults to `(src, dst) -> nothing`;
138
-
default_edge_metadata::Function= (src, dst) ->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()`;
139
-
allow_self_loops::Bool=false# whether to allow self loops to be generated or not. Defaults to `false`.
140
-
)
131
+
name::Symbol, # The name of the layer
132
+
vertices::Union{Vector{MultilayerVertex{nothing}},Vector{Node}}, # The `MultilayerVertex`s of the Layer. May be a vector of `MultilayerVertex{nothing}`s or a vector of `Node`s. In the latter case, the metadata of the `MultilayerVertex` to be added are computed via the `default_vertex_metadata` before the vertex is added (the function will act on each element of `MV.(vertices)`);
133
+
ne::Int64, # The number of edges of the Layer
134
+
null_graph::AbstractGraph{T},# The Layer's underlying graph type, which must be passed as a null graph. If it is not, an error will be thrown.
135
+
weighttype::Type{U}; # The type of the `MultilayerEdge` weights (even when the underlying Layer's graph is unweighted, we need to specify a weight type since the `MultilayerGraph`s will always be weighted)
136
+
default_vertex_metadata::Function= mv ->NamedTuple(), # Function that takes a `MultilayerVertex` and returns a `Tuple` or a `NamedTuple` containing the vertex metadata. Defaults to `mv -> NamedTuple()`;
137
+
default_edge_weight::Function= (src, dst) ->nothing, # Function that takes a pair of `MultilayerVertex`s and returns an edge weight of type `weighttype` or `nothing` (which is compatible with unweighted underlying graphs and corresponds to `one(weighttype)` for weighted underlying graphs). Defaults to `(src, dst) -> nothing`;
138
+
default_edge_metadata::Function= (src, dst) ->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()`;
139
+
allow_self_loops::Bool=false# whether to allow self loops to be generated or not. Defaults to `false`.
140
+
)where {T<:Integer, U<:Real}
141
141
```
142
142
143
-
A `Layer` is considered "weighted" if its underlying graph (`null_graph` argument) has been given the `IsWeighted` trait (traits throughout this package are implemented via [SimpleTraits.jl](https://github.com/mauro3/SimpleTraits.jl), just like Graphs.jl does). Since one may at any moment add a new weighted `Layer` to a `MultilayerGraph` (see below for details), the latter is always considered a "weighted graph", so it is given the `IsWeighted` trait. Thus, all `Layer`s and `Interlayer`s (collectively named "subgraphs" hereafter) must specify their `weighttype` as the last argument of their constructor, so the user may debug their weight matrices ([`weights(subgraph::AbstractSubGraph)`](@ref)) immediately after construction. As better specified below, all subgraphs that are meant to be part of the same `MultilayerGraph` must have the same `weighttype`.
143
+
A `Layer` is considered "weighted" if its underlying graph (`null_graph` argument) has been given the `IsWeighted` trait (traits throughout this package are implemented via [SimpleTraits.jl](https://github.com/mauro3/SimpleTraits.jl), just like Graphs.jl does). Since one may at any moment add a new weighted `Layer` to a `MultilayerGraph` (see below for details), the latter is always considered a "weighted graph", so it is given the `IsWeighted` trait. Thus, all `Layer`s and `Interlayer`s (collectively named "subgraphs" hereafter) must specify their `weighttype` as the last argument of their constructor, so the user may debug their weight matrices ([`weights(subgraph::AbstractSubGraph)`](@ref)) immediately after construction. As better specified below, all subgraphs that are meant to be part of the same `MultilayerGraph` must have the same `weighttype`. Moreover, also the vertex type `T` (i.e. the internal representation of vertices) should be the same.
144
144
145
145
Before instantiating `Layer`s, we define an utility function to ease randomization:
146
146
@@ -154,18 +154,25 @@ end
154
154
155
155
# Utility function that returns two vertices of a Layer that are not adjacent.
The API that inspects and modifies `Layer`s will be shown below together with that of `Interlayer`s, since they are usually the same. There are of course other constructors that you may discover by typing `?Layer` in the console.
229
+
The API that inspects and modifies `Layer`s will be shown below together with that of `Interlayer`s, since they are usually the same. There are of course other constructors that you may discover by reading the [API](@ref subgraphs_eu). They include:
230
+
231
+
1. Constructors that exempt the user from having to explictly specify the `null_graph`, at the cost of some flexibility;
232
+
2. Constructors that allow for a configuration model-like specifications.
223
233
224
234
### Interlayers
225
235
@@ -264,7 +274,7 @@ Interlayer(
264
274
default_edge_weight::Function= (x,y) ->nothing, # Function that takes a pair of `MultilayerVertex`s and returns an edge weight of type `weighttype` or `nothing` (which is compatible with unweighted underlying graphs and corresponds to `one(weighttype)` for weighted underlying graphs). Defaults to `(src, dst) -> nothing`;
265
275
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()`;
266
276
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)");
267
-
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.;
277
+
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.;
There are of course other constructors that you may discover by reading the [API](@ref subgraphs_eu). They include constructors that exempt the user from having to explictly specify the `null_graph`, at the cost of some flexibility;
325
+
314
326
Next, we explore the API associated to modify and analyze `Layer`s and `Interlayer`s.
315
327
316
328
### Subgraphs API
@@ -619,7 +631,7 @@ Given all the `Layer`s and the `Interlayer`s, let's instantiate a multilayer gra
619
631
```julia
620
632
multilayergraph =MultilayerGraph( layers, # The (ordered) list of layers the multilayer graph will have
621
633
interlayers; # The list of interlayers specified by the user. Note that the user does not need to specify all interlayers, as the unspecified ones will be automatically constructed using the indications given by the `default_interlayers_null_graph` and `default_interlayers_structure` keywords.
622
-
default_interlayers_null_graph =SimpleGraph{vertextype}(), # Sets the underlying graph for the interlayers that are to be automatically specified. Defaults to `SimpleGraph{T}()`. See the `Layer` constructors for more information.
634
+
default_interlayers_null_graph =SimpleGraph{vertextype}(), # Sets the underlying graph for the interlayers that are to be automatically specified. Defaults to `SimpleGraph{T}()`, where `T` is the `T` of all the `layers` and `interlayers`. See the `Layer` constructors for more information.
623
635
default_interlayers_structure ="multiplex"# Sets the structure of the interlayers that are to be automatically specified. May be "multiplex" for diagonally coupled interlayers, or "empty" for empty interlayers (no edges). "multiplex". See the `Interlayer` constructors for more information.
624
636
);
625
637
```
@@ -867,7 +879,9 @@ Read a complete list of analytical methods exclusive to multilayer graphs in the
867
879
-[Implement more general configuration models / graph generators](https://github.com/JuliaGraphs/MultilayerGraphs.jl/issues/33);
868
880
-[Implement graph of layers](https://github.com/JuliaGraphs/MultilayerGraphs.jl/issues/34);
869
881
-[Implement projected monoplex and overlay graphs](https://github.com/JuliaGraphs/MultilayerGraphs.jl/issues/35);
870
-
-[Implement more default multilayer graphs](https://github.com/JuliaGraphs/MultilayerGraphs.jl/issues/36) (e.g. multiplex graphs).
882
+
-[Implement more default multilayer graphs](https://github.com/JuliaGraphs/MultilayerGraphs.jl/issues/36) (e.g. multiplex graphs);
883
+
-[Implement configuration models / graph generators for interlayers](https://github.com/JuliaGraphs/MultilayerGraphs.jl/issues/46);
884
+
-[Relax the requirement of same `T` and `U` for all `Layer`s and `Interlayer`s that are meant to constitute a `Multilayer(Di)Graph`](https://github.com/JuliaGraphs/MultilayerGraphs.jl/issues/53).
0 commit comments