Skip to content

Commit 3dc91a7

Browse files
InterdisciplinaryPhysicsTeampitmonticoneClaudMor
committed
Update docstrings
Co-Authored-By: Pietro Monticone <[email protected]> Co-Authored-By: Claudio Moroni <[email protected]>
1 parent db4f6ad commit 3dc91a7

File tree

2 files changed

+15
-23
lines changed

2 files changed

+15
-23
lines changed

docs/src/index.md

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ interlayer_empty_sg_vg = empty_interlayer( layer_sg,
299299
interlayers = [interlayer_sg_swg, interlayer_swg_mg, interlayer_mg_vg, interlayer_multiplex_sg_mg, interlayer_empty_sg_vg]
300300
```
301301

302-
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.
303303

304304
### Subgraphs API
305305

@@ -403,7 +403,7 @@ interlayer_sg_swg_vertices = mv_vertices(interlayer_sg_swg)
403403

404404
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.
405405

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:
407407

408408
```julia
409409
new_node = Node("missing_node")
@@ -428,7 +428,7 @@ add_vertex!(layer_mg, new_node, metadata = new_metadata)
428428
```
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;
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.
432432

433433
Here is an example on how to use it:
434434
```julia
@@ -437,7 +437,7 @@ add_vertex!(layer_mg, new_node, Dict(pairs(new_metadata)))
437437
where `Dict(pairs(new_metadata))` is exactly what you would pass to the `add_vertex!` method that acts on `MetaGraphs`:
438438
```julia
439439
metagraph = MetaGraph()
440-
add_vertex!(metagraph, Dict(pairs(new_metadata)))
440+
add_vertex!(metagraph, Dict(pairs(new_metadata))) # true
441441
```
442442

443443
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
447447
To remove the vertex, simply do:
448448
```julia
449449
rem_vertex!(layer_sg, new_vertex) # Returns true if succeeds
450-
```s
450+
```
451+
451452
To extract metadata:
452453
```julia
453454
get_metadata(layer_mg, MV(new_node))
454455
```
455456

456457
By design, one may not add nor remove vertices to `Interlayer`s.
457458

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).
459460

460461
### [Edges](@ref edges_tut_subg)
461462

@@ -486,7 +487,7 @@ collect(edges(layer_sg))
486487
ME(MV(Node("node_6"), :layer_sg, NamedTuple()) --> MV(Node("node_7"), :layer_sg, NamedTuple()), weight = 1.0, metadata = NamedTuple())
487488
```
488489

489-
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.
490491

491492
The `add_edge` function has the standard, uniform and transparent interfaces too. To understand how they work, let's define a weighted edge:
492493

@@ -528,7 +529,7 @@ add_edge!(simpleweightedgraph, 1, 2, _weight)
528529

529530
If an underlying graph has an `add_edge!` interface whose signature overlaps with that of the uniform interface, the uniform interface will prevail.
530531

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).
532533

533534
To remove the edge, simply do:
534535
```julia
@@ -575,8 +576,6 @@ To extract metadata:
575576
get_metadata(layer_mg, src_m, dst_m)
576577
```
577578

578-
Please refer to the Vertex section of the API page ([end-user]() and [developer]()) to discover more methods related to `MultilayerEdges`s.
579-
580579
For the `layer_swg`, the following three signatures would be equivalent:
581580

582581
- *standard* interface:
@@ -600,8 +599,6 @@ The edge may be removed via
600599
rem_edge!(layer_swg, src_w, dst_w)
601600
```
602601

603-
Please refer to the `MultilayerEdge` section of the API page ([end-user]() and [developer]()) to discover more methods related to `MultilayerEdge`s.
604-
605602
### Multilayer Graphs
606603

607604
Given all the `Layer`s and the `Interlayer`s, let's instantiate a multilayer graph as follows:
@@ -614,7 +611,7 @@ multilayergraph = MultilayerGraph( layers,
614611
);
615612
```
616613

617-
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!`.**
618615

619616
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`.
620617

@@ -626,7 +623,8 @@ It is used as:
626623

627624

628625
```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
630628

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

@@ -650,11 +648,7 @@ end
650648
configuration_multilayergraph = MultilayerGraph(empty_layers, empty_interlayers, truncated(Normal(10), 0.0, 20.0));
651649
```
652650

653-
┌ Info: Looping through wirings to find one that works...
654-
└ @ MultilayerGraphs E:\other_drives\developer07\package_development\MultilayerGraphs\dev\MultilayerGraphs\src\utilities.jl:441
655-
656-
657-
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).
658652

659653
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.
660654

@@ -675,7 +669,6 @@ Now one may add vertices that represent that node, e.g.:
675669
```julia
676670
new_vertex = MV(new_node, :layer_sg)
677671
add_vertex!(multilayergraph, new_vertex)
678-
rem_vertex!(multilayergraph, new_vertex) # hide
679672
```
680673
```nothing
681674
true
@@ -829,7 +822,6 @@ Note that `wgt` is an object of type [`WeightTensor`](@ref). You may access its
829822

830823
```julia
831824
array(wgt)
832-
; # hide
833825
```
834826

835827
Also, you may index it using `MultilayerVertex`s:
@@ -851,7 +843,7 @@ The package also exports a [`SupraWeightMatrix`](@ref) which is a supra (weighte
851843

852844
#### Multilayer-specific analytical tools
853845

854-
Read a complete list of analytical methods exclusive to multilayer graphs in the dedicated [API section](@ref API) (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](@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.
855847

856848
### Future Developments
857849

src/abstractmultilayergraph.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ Graphs.indegree(mg::AbstractMultilayerGraph, vs::AbstractVector{<:MultilayerVert
492492
493493
Get the outdegree of vertex `v` in `mg`.
494494
"""
495-
Graphs.outdegree(mg::AbstractMultilayerGraph, mv::MultilayerVertex) = length(outneighbors(mg, v))
495+
Graphs.outdegree(mg::AbstractMultilayerGraph, mv::MultilayerVertex) = length(outneighbors(mg, mv))
496496

497497
"""
498498
outdegree(mg::M, vs::AbstractVector{V}=vertices(mg)) where {T,M<:AbstractMultilayerGraph{T,<:Real},V<:MultilayerVertex}

0 commit comments

Comments
 (0)