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
set_weight!(mg::M, src::MultilayerVertex{L1}, dst::MultilayerVertex{L2}, weight::U) where {L1 <: Symbol, L2 <: Symbol, T,U, M <: AbstractMultilayerGraph{T,U}}
136
128
137
129
Set the weight of the edge between `src` and `dst` to `weight`. Return true if succeeds (i.e. if the edge exists and the underlying graph chosen for the Layer/Interlayer where the edge lies is weighted under the `IsWeighted` trait).
138
130
"""
139
131
functionset_weight!(mg::M, src::MultilayerVertex, dst::MultilayerVertex, weight::U) where { T,U, M <:AbstractMultilayerDiGraph{T,U}}
132
+
# Get the subgraph descriptor for the layer containing both src and dst
set_metadata!(mg::M, src::MultilayerVertex{L1}, dst::MultilayerVertex{L2}, metadata::U) where {L1 <: Symbol, L2 <: Symbol, T,U, M <: AbstractMultilayerGraph{T,U}}
160
153
161
154
Set the metadata of the edge between `src` and `dst` to `metadata`. Return true if succeeds (i.e. if the edge exists and the underlying graph chosen for the Layer/Interlayer where the edge lies supports metadata at the edge level under the `IsMeta` trait).
162
155
"""
163
156
functionset_metadata!(mg::M, src::MultilayerVertex, dst::MultilayerVertex, metadata::Union{Tuple, NamedTuple}) where M <:AbstractMultilayerDiGraph
157
+
# Get the subgraph descriptor that corresponds to the layer of src and dst
# Overloads that make AbstractMultilayerDiGraph an extension of Graphs.jl. These are all well-inferred .
182
175
"""
@@ -389,18 +382,19 @@ end
389
382
return _inneighbors
390
383
end
391
384
392
-
393
-
# function get_overlay_monoplex_graph end #approach taken from https://github.com/JuliaGraphs/Graphs.jl/blob/7152d540631219fd51c43ab761ec96f12c27680e/src/core.jl#L124
394
385
"""
395
386
get_overlay_monoplex_graph(mg::M) where {M<: AbstractMultilayerDiGraph}
396
387
Get overlay monoplex graph (i.e. the graph that has the same nodes as `mg` but the link between node `i` and `j` has weight equal to the sum of all edges weights between the various vertices representing `i` and `j` in `mg`, accounting for both layers and interlayers). See [De Domenico et al. (2013)](https://doi.org/10.1103/PhysRevX.3.041022).
397
388
"""
398
389
functionget_overlay_monoplex_graph(mg::M) where {T,U,M<:AbstractMultilayerDiGraph{T,U}}
390
+
# Convert the multilayer graph to a weight tensor
399
391
wgt =weight_tensor(mg).array
392
+
# Sum the weights for each edge in the multilayer graph
400
393
projected_overlay_adjacency_matrix =sum([
401
394
wgt[:, :, i, i] for i in1:size(wgt, 3)
402
395
])
403
396
returnSimpleWeightedDiGraph{T,U}(
404
397
projected_overlay_adjacency_matrix
405
398
)
399
+
# Approach taken from https://github.com/JuliaGraphs/Graphs.jl/blob/7152d540631219fd51c43ab761ec96f12c27680e/src/core.jl#L124
0 commit comments