Skip to content

Commit 80b519a

Browse files
InterdisciplinaryPhysicsTeamClaudMorpitmonticone
committed
Clean docstrings
Co-Authored-By: Claudio Moroni <43729990+ClaudMor@users.noreply.github.com> Co-Authored-By: Pietro Monticone <38562595+pitmonticone@users.noreply.github.com>
1 parent de5dcd4 commit 80b519a

File tree

7 files changed

+19
-19
lines changed

7 files changed

+19
-19
lines changed

docs/src/index.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ multilayervertices_meta[1]
120120
MV(Node("node_1"), :nothing, ("I'm node node_1",))
121121
```
122122

123-
Where `MV` is an alias for `MultilayerVertex`. The first field is the `Node` being represented (accessible via the [`node`](@ref) function), the second the (name of) the layer the vertex is represented in (accessible via the [`layer`](@ref) function, here it is set to `nothing`, since these vertices are yet to be assigned), and the metadata associated to the vertex (accessible via the [`metadata`](@ref) function, no metadata are currently represented via an empty `NamedTuple`). `MultilayerVertex` metadata can be represented via a `Tuple` or a `NamedTuple` (see below for examples). For a complete list of methods applicable to `MultilayerVertices`, plese refer to the [Vertices](@ref vertices_eu) of the API.
123+
Where `MV` is an alias for `MultilayerVertex`. The first field is the `Node` being represented (accessible via the [`node`](@ref) function), the second the (name of) the layer the vertex is represented in (accessible via the [`layer`](@ref) function, here it is set to `nothing`, since these vertices are yet to be assigned), and the metadata associated to the vertex (accessible via the [`metadata`](@ref) function, no metadata are currently represented via an empty `NamedTuple`). `MultilayerVertex` metadata can be represented via a `Tuple` or a `NamedTuple` (see below for examples). For a complete list of methods applicable to `MultilayerVertices`, please refer to the [Vertices](@ref vertices_eu) of the API.
124124

125125
### Layers
126126

@@ -142,7 +142,7 @@ Layer(
142142

143143
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.
144144

145-
Before instantiating `Layer`s, we define an utility function to ease randomization:
145+
Before instantiating `Layer`s, we define an utility function to ease randomisation:
146146

147147
```julia
148148
# Utility function that returns a random number of vertices and edges each time it is called:
@@ -228,7 +228,7 @@ layers = [layer_sg, layer_swg, layer_mg, layer_vg]
228228

229229
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:
230230

231-
1. Constructors that exempt the user from having to explictly specify the `null_graph`, at the cost of some flexibility;
231+
1. Constructors that exempt the user from having to explicitly specify the `null_graph`, at the cost of some flexibility;
232232
2. Constructors that allow for a configuration model-like specifications.
233233

234234
### Interlayers
@@ -321,7 +321,7 @@ interlayer_empty_sg_vg = empty_interlayer( layer_sg,
321321
interlayers = [interlayer_sg_swg, interlayer_swg_mg, interlayer_mg_vg, interlayer_multiplex_sg_mg, interlayer_empty_sg_vg]
322322
```
323323

324-
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;
324+
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 explicitly specify the `null_graph`, at the cost of some flexibility;
325325

326326
Next, we explore the API associated to modify and analyze `Layer`s and `Interlayer`s.
327327

@@ -649,7 +649,7 @@ It is used as:
649649

650650
```julia
651651
# The configuration model-like constructor will be responsible for creating the edges, so we need to provide it with empty layers and interlayers.
652-
# 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
652+
# To create empty layers and interlayers, we will empty the above subgraphs, and, for compatibility 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
653653

654654
empty_layers = deepcopy([layer for layer in layers if !(layer.graph isa SimpleWeightedGraphs.AbstractSimpleWeightedGraph)])
655655

src/MultilayerGraphs.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
# The δ_Ω implementation could be moved to a separate file.
1616

17-
# The usage of mutable `MissingVertex`s (although limited to SupraWeightMatrix) points to the fact that Bijections (at least as they are used right now) are not the best way to represent integer label-MultilayerVertex associations. We my implement our own container object or use the exixtsing ons differently.
17+
# The usage of mutable `MissingVertex`s (although limited to SupraWeightMatrix) points to the fact that Bijections (at least as they are used right now) are not the best way to represent integer label-MultilayerVertex associations. We my implement our own container object or use the existing ons differently.
1818

1919
# We need a quick Multilayer(Di)Graph constructor of the form Multilayer(Di)Graph(nn, nl; nv = rand(0:nn*nl), ne = rand(0:nv*(nv-1)) kwargs...) where kwargs may be used to further specify it.
2020

src/abstractmultilayergraph.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1188,7 +1188,7 @@ function get_rich_mv(
11881188
) where {T,U,M<:AbstractMultilayerGraph{T,U}}
11891189
if perform_checks
11901190
haskey(mg.v_V_associations, i) ||
1191-
throw(ErrorException("$i is not a vertex of the multilayer graph"))
1191+
throw(ErrorException("$i is not a vertex of the multilayer graph."))
11921192
end
11931193

11941194
bare_V = mg.v_V_associations[i]

src/multilayerdigraph.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ mutable struct MultilayerDiGraph{T,U} <: AbstractMultilayerDiGraph{T,U}
99
v_V_associations::Bijection{T,<:MultilayerVertex} # A Bijection from Bijections.jl that associates numeric vertices to `MultilayerVertex`s.
1010
idx_N_associations::Bijection{Int64,Node} # A Bijection from Bijections.jl that associates Int64 to `Node`s.
1111
fadjlist::Vector{Vector{HalfEdge{<:MultilayerVertex,<:Union{Nothing,U}}}} # the forward adjacency list of the MultilayerDiGraph. It is a vector of vectors of `HalfEdge`s. Its i-th element are the `HalfEdge`s that originate from `v_V_associations[i]`.
12-
badjlist::Vector{Vector{HalfEdge{<:MultilayerVertex,<:Union{Nothing,U}}}} # the bacward adjacency list of the MultilayerDiGraph. It is a vector of vectors of `HalfEdge`s. Its i-th element are the `HalfEdge`s that insost on `v_V_associations[i]`.
12+
badjlist::Vector{Vector{HalfEdge{<:MultilayerVertex,<:Union{Nothing,U}}}} # the backward adjacency list of the MultilayerDiGraph. It is a vector of vectors of `HalfEdge`s. Its i-th element are the `HalfEdge`s that insist on `v_V_associations[i]`.
1313
v_metadata_dict::Dict{T,<:Union{<:Tuple,<:NamedTuple}} # A Dictionary that associates numeric vertices to their metadata
1414
end
1515

@@ -203,7 +203,7 @@ function MultilayerDiGraph(
203203
perform_checks::Bool=false,
204204
) where {T,U}
205205
(allow_self_loops && perform_checks) &&
206-
@warn "Checks for graphicality and coherence with the provided `empty_multilayerdigraph` are currently performed without taking into account self-loops. Thus said checks may fail event though the provided `indegree_sequence` and `outdegree_sequence` may be graphical when one allows for self-loops within the directed multilayer graph to be present. If you are sure that the provided `indegree_sequence` and `outdegree_sequence` are indeed graphical under those circumstances, you may want to disable checks by setting `perform_checks = false`. We apologize for the inconvenient."
206+
@warn "Checks for graphicality and coherence with the provided `empty_multilayerdigraph` are currently performed without taking into account self-loops. Thus said checks may fail event though the provided `indegree_sequence` and `outdegree_sequence` may be graphical when one allows for self-loops within the directed multilayer graph to be present. If you are sure that the provided `indegree_sequence` and `outdegree_sequence` are indeed graphical under those circumstances, you may want to disable checks by setting `perform_checks = false`. We apologize for the inconvenience."
207207

208208
_multilayerdigraph = deepcopy(empty_multilayerdigraph)
209209

@@ -217,19 +217,19 @@ function MultilayerDiGraph(
217217
n = nv(_multilayerdigraph)
218218
n == length(indegree_sequence) == length(outdegree_sequence) || throw(
219219
ErrorException(
220-
"The number of vertices of the provided empty MultilayerDiGraph does not match the length of the `indegree_sequence` or the `outdegree_sequence`. Found $(nv(_multilayerdigraph)) , $(length(indegree_sequence)) and $(length(outdegree_sequence))",
220+
"The number of vertices of the provided empty MultilayerDiGraph does not match the length of the `indegree_sequence` or the `outdegree_sequence`. Found $(nv(_multilayerdigraph)) , $(length(indegree_sequence)) and $(length(outdegree_sequence)).",
221221
),
222222
)
223223

224224
sum(indegree_sequence) == sum(outdegree_sequence) || throw(
225225
ErrorException(
226-
"The sum of the `indegree_sequence` and the `outdegree_sequence` must match. Found $(sum(indegree_sequence)) and $(sum(outdegree_sequence))",
226+
"The sum of the `indegree_sequence` and the `outdegree_sequence` must match. Found $(sum(indegree_sequence)) and $(sum(outdegree_sequence)).",
227227
),
228228
)
229229

230230
isdigraphical(degree_sequence) || throw(
231231
ArgumentError(
232-
"`indegree_sequence` and `outdegree_sequence` must be digraphical"
232+
"`indegree_sequence` and `outdegree_sequence` must be digraphical."
233233
),
234234
)
235235
end

src/multilayergraph.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ Construct a MultilayerGraph with layers given by `layers`. The interlayers will
2929
# ARGUMENTS
3030
3131
- `layers::Vector{<:Layer{T,U}}`: The (ordered) list of layers the multilayer graph will have;
32-
- `specified_interlayers::Vector{<:Interlayer{T,U}}`: 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.;
33-
- `default_interlayers_null_graph::H = SimpleGraph{T}()`: Sets the underlying graph for the interlayers that are to be automatically specified. Defaults to `SimpleGraph{T}()`. See the `Layer` constructors for more information.;
34-
- `default_interlayers_structure::String = "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.;
32+
- `specified_interlayers::Vector{<:Interlayer{T,U}}`: 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;
33+
- `default_interlayers_null_graph::H = SimpleGraph{T}()`: Sets the underlying graph for the interlayers that are to be automatically specified. Defaults to `SimpleGraph{T}()`. See the `Layer` constructors for more information;
34+
- `default_interlayers_structure::String = "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.
3535
"""
3636
function MultilayerGraph(
3737
layers::Vector{<:Layer{T,U}},

src/traits.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ is_weighted(g::G) where {G<:Type{<:AbstractGraph}} = istrait(IsWeighted{g})
2525
"""
2626
IsMeta{X}
2727
28-
Trait that discerns between graphs that sport edge and vertex metadata.
28+
Trait that discerns between graphs that sport edge and vertex metadata.
2929
"""
3030
@traitdef IsMeta{X}
3131

src/utilities.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -655,8 +655,8 @@ Returns a simple directed graph with given finite in-degree and out-degree seque
655655
4. Repeat from 1. until all indegree-outdegree pairs are of the form (0.0).
656656
657657
## References
658-
- [Wikipedia](https://en.wikipedia.org/wiki/Kleitman%E2%80%93Wang_algorithms)
659-
- [Kleitman and Wang (1973)](https://doi.org/10.1016/0012-365X(73)90037-X)
658+
- [Wikipedia](https://en.wikipedia.org/wiki/Kleitman%E2%80%93Wang_algorithms);
659+
- [Kleitman and Wang (1973)](https://doi.org/10.1016/0012-365X(73)90037-X).
660660
"""
661661
function kleitman_wang_graph_generator(
662662
indegree_sequence::AbstractVector{<:Integer},
@@ -724,7 +724,7 @@ end
724724
"""
725725
sample_graphical_degree_sequence(degree_distribution::UnivariateDistribution, n::Integer)
726726
727-
Sample a graphical degree sequence for a graph with `n` vertices from `degree_distribution`
727+
Sample a graphical degree sequence for a graph with `n` vertices from `degree_distribution`.
728728
"""
729729
function sample_graphical_degree_sequence(
730730
degree_distribution::UnivariateDistribution, n::Integer

0 commit comments

Comments
 (0)