API
This page provides a list of exported methods organized by topic and audience. Methods that act on vertices, edges, and layers are grouped together. Some methods are intended for developers who want to use the Graphs.jl
library as part of their code, while others are meant for end-users.
End-User
Nodes
MultilayerGraphs.Node
— TypeNode <: AbstractNode
A custom concrete type representing a node of a multilayer graph.
MultilayerGraphs.id
— Functionid(n::Node)
Return the id of n
.
Vertices
Base.eltype
— FunctionBase.eltype(subgraph::AbstractSubGraph)
Return the vertex type of subgraph
.
eltype(::M) where {T,M<:AbstractMultilayerGraph{T}}
Return the vertex type of mg
.
MultilayerGraphs.MultilayerVertex
— TypeMultilayerVertex{N <: Integer} <: AbstractMultilayerVertex{N}
A struct representing a vertex of a MultilayerGraph.
FIELDS
node::Node
: theNode
that theMultilayerVertex
represents;layer::Union{Nothing, Symbol}
: the name of theLayer
theMultilayerVertex
lies in;metadata::Union{<: NamedTuple, <: Tuple}
: the metadata associated to thisMultilayerVertex
.
CONSTRUCTORS
MultilayerVertex(node::Node, layer::Union{Nothing, Symbol}, metadata::Union{<: NamedTuple, <: Tuple})
Constructs a MultilayerVertex
representing Node
node
in Layer
with metadata metadata
.
MultilayerGraphs.MV
— TypeMV
Alias for MultilayerVertex
MultilayerGraphs.node
— Functionnode(mv::MultilayerVertex)
Returns the Node represented by mv
.
MultilayerGraphs.layer
— Functionlayer(mv::MultilayerVertex)
Return the name of the layer which the MultilayerVertex
belongs to.
MultilayerGraphs.metadata
— Methodmetadata(mv::MultilayerVertex)
Return the metadata associated to mv
.
MultilayerGraphs.MissingVertex
— TypeMissingVertex
A mutable struct that acts as a placeholder for a vertex that is missing in a Layer. It is mutable so that it may be added more than once to the Bijections
struct from Bijections.jl.
Edges
MultilayerGraphs.MultilayerEdge
— Typestruct MultilayerEdge{ T <: MultilayerVertex, U <: Union{ <: Real, Nothing}} <: AbstractMultilayerEdge{T}
Default concrete subtype of AbstractMultilayerEdge.
FIELDS
src::T
: the source vertex of the edge;dst::T
: the destination vertex of the edge;weight::U
: the edge weight.
CONSTRUCTORS
MultilayerEdge(src::T, dst::T, weight::U) where { T <: MultilayerVertex, U <: Union{ <: Real, Nothing}}
Default constructor.
MultilayerGraphs.ME
— TypeME
Shorter alias for MultilayerEdge.
SimpleWeightedGraphs.weight
— Methodweight(e::AbstractMultilayerEdge)
Return the weight of e
.
MultilayerGraphs.metadata
— Methodmetadata(e::AbstractMultilayerEdge)
Return the metadata of e
.
Subgraphs
MultilayerGraphs.Layer
— Typemutable struct Layer{T <: Integer, U <: Real, G <: AbstractGraph{T}} <: AbstractLayer{T,U,G}
Represents a layer in a Multilayer(Di)Graph
. Its type hierarchy is: Layer <: AbstractLayer <: AbstractSubGraph .
MultilayerGraphs.Layer
— MethodLayer(
name::Symbol,
vertices::Vector{<: MultilayerVertex},
edge_list::Union{Vector{<:MultilayerEdge}, Vector{NTuple{2, MultilayerVertex{nothing}}}},
null_graph::G,
weighttype::Type{U};
default_vertex_metadata::Function = mv -> NamedTuple(),
default_edge_weight::Function = (src, dst) -> one(U), d
default_edge_metadata::Function = (src, dst) -> NamedTuple()) where {T <: Integer, U <: Real, G <: AbstractGraph{T}}
Constructor for Layer
.
ARGUMENTS
name::Symbol
: The name of the Layer;vertices::Union{Vector{MultilayerVertex{nothing}},Vector{Node}}
: TheMultilayerVertex
s of the Layer. May be a vector ofMultilayerVertex{nothing}
s or a vector ofNode
s. In the latter case, the metadata of theMultilayerVertex
to be added are computed via thedefault_vertex_metadata
before the vertex is added (the function will act on each element ofMV.(vertices)
);edge_list::Union{Vector{<:MultilayerEdge}, Vector{NTuple{2, MultilayerVertex{nothing}}}}
: The list ofMultilayerEdge
s. It may be a vector ofMultilayerEdge
s or a Vector of 2-tuples ofMultilayerVertex
s. In the latter case, the weight and the metadata of theMultilayerEdge
to be added are computed respectively via thedefault_edge_weight
anddefault_edge_metadata
functions;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;weighttype::Type{U}
: The type of theMultilayerEdge
weights (even when the underlying Layer's graph is unweighted, we need to specify a weight type since theMultilayerGraph
s will always be weighted)
MultilayerGraphs.Layer
— MethodLayer(
name::Symbol,
vertices::Union{V, N},
ne::Int64,
null_graph::G,
weighttype::Type{U};
default_vertex_metadata::Function = mv -> NamedTuple(),
default_edge_weight::Function = (src, dst) -> nothing,
default_edge_metadata::Function = (src, dst) -> NamedTuple(),
allow_self_loops::Bool = false
) where {T<:Integer,U<:Real,G<:AbstractGraph{T}, V <: Vector{MultilayerVertex{nothing}}, N <: Vector{Node}}
Return a random Layer
.
ARGUMENTS
vertices::Union{V, N}
: TheMultilayerVertex
s of the Layer. May be a vector ofMultilayerVertex{nothing}
s or a vector ofNode
s. In the latter case, the metadata of theMultilayerVertex
to be added are computed via thedefault_vertex_metadata
before the vertex is added (the function will act on each element ofMV.(vertices)
);name::Symbol
: The name of the Layerne::Int64
: The number of edges of the Layernull_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.weighttype::Type{U}
: The type of theMultilayerEdge
weights (even when the underlying Layer's graph is unweighted, we need to specify a weight type since theMultilayerGraph
s will always be weighted);
KWARGS
-default_vertex_metadata::Function
: Function that takes a MultilayerVertex
and returns a Tuple
or a NamedTuple
containing the vertex metadata. defaults to mv -> NamedTuple()
;
default_edge_weight::Function
: Function that takes a pair ofMultilayerVertex
s and returns an edge weight of typeweighttype
ornothing
(which is compatible with unweighted underlying graphs and corresponds toone(weighttype)
for weighted underlying graphs). Defaults to(src, dst) -> nothing
;default_edge_metadata::Function
: Function that takes a pair ofMultilayerVertex
s and returns aTuple
or aNamedTuple
containing the edge metadata, that will be called whenadd_edge!(mg,src,dst, args...; kwargs...)
is called without themetadata
keyword argument, and when generating the edges in this constructor. Defaults to(src, dst) -> NamedTuple()
;allow_self_loops::Bool
: whether to allow self loops to be generated or not. Defaults tofalse
.
MultilayerGraphs.layer_simplegraph
— Functionlayer_simplegraph(
name::Symbol,
vertices::Union{Vector{MultilayerVertex{nothing}},Vector{Node}},
edge_list::Union{Vector{<:MultilayerEdge}, Vector{NTuple{2, MultilayerVertex{nothing}}}};
vertextype::Type{T} = Int64,
weighttype::Type{U} = Float64
) where {T<:Integer,U<:Real}
Constructor for a Layer
whose underlying graph is a SimpleGraph
from Graphs.jl
.
ARGUMENTS
name::Symbol
: The name of the Layer;vertices::Union{Vector{MultilayerVertex{nothing}},Vector{Node}}
: TheMultilayerVertex
s of the Layer. May be a vector ofMultilayerVertex{nothing}
s or a vector ofNode
s. In the latter case, the metadata of theMultilayerVertex
to be added are computed via thedefault_vertex_metadata
before the vertex is added (the function will act on each element ofMV.(vertices)
);edge_list::Union{Vector{<:MultilayerEdge}, Vector{NTuple{2, MultilayerVertex{nothing}}}}
: The list ofMultilayerEdge
s. It may be a vector ofMultilayerEdge
s or a Vector of 2-tuples ofMultilayerVertex
s. In the latter case, the weight and the metadata of theMultilayerEdge
to be added are computed respectively via thedefault_edge_weight
anddefault_edge_metadata
functions;vertextype::Type{T} = Int64
: The type of the underlying integer labels associated to vertices.weighttype::Type{U} = Float64
: The type of theMultilayerEdge
weights (even when the underlying Layer's graph is unweighted, we need to specify a weight type since theMultilayerGraph
s will always be weighted)
layer_simplegraph(
name::Symbol,
vertices::Union{Vector{MultilayerVertex{nothing}},Vector{Node}},
degree_distribution::UnivariateDistribution;
vertextype::Type{T} = Int64,
weighttype::Type{U} = Float64
) where {T<:Integer,U<:Real}
Constructor for a Layer
whose underlying graph is a SimpleGraph
from Graphs.jl
with a degree sequence sampled from degree_distribution
. Realization is performed via the Havel-Hakimi algorithm.
ARGUMENTS
name::Symbol
: The name of the Layer;vertices::Union{Vector{MultilayerVertex{nothing}},Vector{Node}}
: TheMultilayerVertex
s of the Layer. May be a vector ofMultilayerVertex{nothing}
s or a vector ofNode
s. In the latter case, the metadata of theMultilayerVertex
to be added are computed via thedefault_vertex_metadata
before the vertex is added (the function will act on each element ofMV.(vertices)
);degree_distribution::UnivariateDistribution
: The degree distribution from which the degree sequence is sampled ;vertextype::Type{T} = Int64
: The type of the underlying integer labels associated to vertices.weighttype::Type{U} = Float64
: The type of theMultilayerEdge
weights (even when the underlying Layer's graph is unweighted, we need to specify a weight type since theMultilayerGraph
s will always be weighted)
layer_simplegraph(
name::Symbol,
vertices::Union{Vector{MultilayerVertex{nothing}},Vector{Node}},
ne::Int64;
vertextype::Type{T} = Int64,
weighttype::Type{U} = Float64
) where {T<:Integer,U<:Real}
Return a random Layer
with ne
edges whose underlying graph is a SimpleGraph
from Graphs.jl
with a degree sequence sampled from degree_distribution
. Realization is performed via the Havel-Hakimi algorithm.
ARGUMENTS
name::Symbol
: The name of the Layer;vertices::Union{Vector{MultilayerVertex{nothing}},Vector{Node}}
: TheMultilayerVertex
s of the Layer. May be a vector ofMultilayerVertex{nothing}
s or a vector ofNode
s. In the latter case, the metadata of theMultilayerVertex
to be added are computed via thedefault_vertex_metadata
before the vertex is added (the function will act on each element ofMV.(vertices)
);ne::Int64
: The number of edges of the Layer;vertextype::Type{T} = Int64
: The type of the underlying integer labels associated to vertices.weighttype::Type{U} = Float64
: The type of theMultilayerEdge
weights (even when the underlying Layer's graph is unweighted, we need to specify a weight type since theMultilayerGraph
s will always be weighted)
MultilayerGraphs.layer_simpledigraph
— Functionlayer_simpledigraph(
name::Symbol,
vertices::Union{Vector{MultilayerVertex{nothing}},Vector{Node}},
edge_list::Union{Vector{<:MultilayerEdge}, Vector{NTuple{2, MultilayerVertex{nothing}}}};
vertextype::Type{T} = Int64,
weighttype::Type{U} = Float64
) where {T<:Integer,U<:Real}
Constructor for a Layer
whose underlying graph is a SimpleDiGraph
from Graphs.jl
.
ARGUMENTS
name::Symbol
: The name of the Layer;vertices::Union{Vector{MultilayerVertex{nothing}},Vector{Node}}
: TheMultilayerVertex
s of the Layer. May be a vector ofMultilayerVertex{nothing}
s or a vector ofNode
s. In the latter case, the metadata of theMultilayerVertex
to be added are computed via thedefault_vertex_metadata
before the vertex is added (the function will act on each element ofMV.(vertices)
);edge_list::Union{Vector{<:MultilayerEdge}, Vector{NTuple{2, MultilayerVertex{nothing}}}}
: The list ofMultilayerEdge
s. It may be a vector ofMultilayerEdge
s or a Vector of 2-tuples ofMultilayerVertex
s. In the latter case, the weight and the metadata of theMultilayerEdge
to be added are computed respectively via thedefault_edge_weight
anddefault_edge_metadata
functions;vertextype::Type{T} = Int64
: The type of the underlying integer labels associated to vertices.weighttype::Type{U} = Float64
: The type of theMultilayerEdge
weights (even when the underlying Layer's graph is unweighted, we need to specify a weight type since theMultilayerGraph
s will always be weighted)
layer_simpledigraph(
name::Symbol,
vertices::Union{Vector{MultilayerVertex{nothing}},Vector{Node}},
indegree_distribution::UnivariateDistribution,
outdegree_distribution::UnivariateDistribution;
vertextype::Type{T} = Int64,
weighttype::Type{U} = Float64
) where {T<:Integer,U<:Real}
Constructor for a Layer
whose underlying graph is a SimplDiGraph{vertextype}
from Graphs.jl
with a indegree and outdegree sequences respectively sampled from indegree_distribution
and outdegree_distribution
. Realization is performed via the Kleitman-Wang algorithm.
ARGUMENTS
name::Symbol
: The name of the Layer;vertices::Union{Vector{MultilayerVertex{nothing}},Vector{Node}}
: TheMultilayerVertex
s of the Layer. May be a vector ofMultilayerVertex{nothing}
s or a vector ofNode
s. In the latter case, the metadata of theMultilayerVertex
to be added are computed via thedefault_vertex_metadata
before the vertex is added (the function will act on each element ofMV.(vertices)
);indegree_distribution::UnivariateDistribution
: The degree distribution from which the indegree sequence is sampled ;outdegree_distribution::UnivariateDistribution
: The degree distribution from which the outdegree sequence is sampled ;vertextype::Type{T} = Int64
: The type of the underlying integer labels associated to vertices.weighttype::Type{U} = Float64
: The type of theMultilayerEdge
weights (even when the underlying Layer's graph is unweighted, we need to specify a weight type since theMultilayerGraph
s will always be weighted)
layer_simpledigraph(
name::Symbol,
vertices::Union{Vector{MultilayerVertex{nothing}},Vector{Node}},
ne::Int64;
vertextype::Type{T} = Int64,
weighttype::Type{U} = Float64
) where {T<:Integer,U<:Real}
Return a random Layer
with ne
edges whose underlying graph is a SimplDiGraph{vertextype}
from Graphs.jl
with a indegree and outdegree sequences respectively sampled from indegree_distribution
and outdegree_distribution
. Realization is performed via the Kleitman-Wang algorithm.
ARGUMENTS
name::Symbol
: The name of the Layer;vertices::Union{Vector{MultilayerVertex{nothing}},Vector{Node}}
: TheMultilayerVertex
s of the Layer. May be a vector ofMultilayerVertex{nothing}
s or a vector ofNode
s. In the latter case, the metadata of theMultilayerVertex
to be added are computed via thedefault_vertex_metadata
before the vertex is added (the function will act on each element ofMV.(vertices)
);ne::Int64
: The number of edges of the Layer;vertextype::Type{T} = Int64
: The type of the underlying integer labels associated to vertices.weighttype::Type{U} = Float64
: The type of theMultilayerEdge
weights (even when the underlying Layer's graph is unweighted, we need to specify a weight type since theMultilayerGraph
s will always be weighted)
MultilayerGraphs.layer_simpleweightedgraph
— Functionlayer_simpleweightedgraph(
name::Symbol,
vertices::Union{Vector{MultilayerVertex{nothing}},Vector{Node}},
edge_list::Union{Vector{<:MultilayerEdge}, Vector{NTuple{2, MultilayerVertex{nothing}}}};
default_edge_weight::Function = (src,dst) -> nothing,
vertextype::Type{T} = Int64,
weighttype::Type{U} = Float64
) where {T<:Integer,U<:Real}
Constructor for a Layer
whose underlying graph is a SimpleWeightedGraph
from SimpleWeightedGraphs.jl
.
ARGUMENTS
name::Symbol
: The name of the Layer;vertices::Union{Vector{MultilayerVertex{nothing}},Vector{Node}}
: TheMultilayerVertex
s of the Layer. May be a vector ofMultilayerVertex{nothing}
s or a vector ofNode
s. In the latter case, the metadata of theMultilayerVertex
to be added are computed via thedefault_vertex_metadata
before the vertex is added (the function will act on each element ofMV.(vertices)
);edge_list::Union{Vector{<:MultilayerEdge}, Vector{NTuple{2, MultilayerVertex{nothing}}}}
: The list ofMultilayerEdge
s. It may be a vector ofMultilayerEdge
s or a Vector of 2-tuples ofMultilayerVertex
s. In the latter case, the weight and the metadata of theMultilayerEdge
to be added are computed respectively via thedefault_edge_weight
anddefault_edge_metadata
functions;default_edge_weight::Function
: Function that takes a pair ofMultilayerVertex
s and returns an edge weight of typeweighttype
ornothing
(which is compatible with unweighted underlying graphs and corresponds toone(weighttype)
for weighted underlying graphs). Defaults to(src, dst) -> nothing
;vertextype::Type{T} = Int64
: The type of the underlying integer labels associated to vertices.weighttype::Type{U} = Float64
: The type of theMultilayerEdge
weights (even when the underlying Layer's graph is unweighted, we need to specify a weight type since theMultilayerGraph
s will always be weighted)
layer_simpleweightedgraph(
name::Symbol,
vertices::Union{Vector{MultilayerVertex{nothing}},Vector{Node}},
degree_distribution::UnivariateDistribution;
default_edge_weight::Function = (src,dst) -> nothing,
vertextype::Type{T} = Int64,
weighttype::Type{U} = Float64
) where {T<:Integer,U<:Real}
Constructor for a Layer
whose underlying graph is a SimpleWeightedGraph
from SimpleWeightedGraphs.jl
. with a degree sequence sampled from degree_distribution
. Realization is performed via the Havel-Hakimi algorithm.
ARGUMENTS
name::Symbol
: The name of the Layer;vertices::Union{Vector{MultilayerVertex{nothing}},Vector{Node}}
: TheMultilayerVertex
s of the Layer. May be a vector ofMultilayerVertex{nothing}
s or a vector ofNode
s. In the latter case, the metadata of theMultilayerVertex
to be added are computed via thedefault_vertex_metadata
before the vertex is added (the function will act on each element ofMV.(vertices)
);degree_distribution::UnivariateDistribution
: The degree distribution from which the degree sequence is sampled ;default_edge_weight::Function
: Function that takes a pair ofMultilayerVertex
s and returns an edge weight of typeweighttype
ornothing
(which is compatible with unweighted underlying graphs and corresponds toone(weighttype)
for weighted underlying graphs). Defaults to(src, dst) -> nothing
;vertextype::Type{T} = Int64
: The type of the underlying integer labels associated to vertices.weighttype::Type{U} = Float64
: The type of theMultilayerEdge
weights (even when the underlying Layer's graph is unweighted, we need to specify a weight type since theMultilayerGraph
s will always be weighted)
layer_simpleweightedgraph(
name::Symbol,
vertices::Union{Vector{MultilayerVertex{nothing}},Vector{Node}},
ne::Int64;
default_edge_weight::Function = (src,dst) -> nothing,
vertextype::Type{T} = Int64,
weighttype::Type{U} = Float64
) where {T<:Integer,U<:Real}
Return a random Layer
with ne
edges whose underlying graph is a SimpleWeightedGraph
from SimpleWeightedGraphs.jl
. with a degree sequence sampled from degree_distribution
. Realization is performed via the Havel-Hakimi algorithm.
ARGUMENTS
name::Symbol
: The name of the Layer;vertices::Union{Vector{MultilayerVertex{nothing}},Vector{Node}}
: TheMultilayerVertex
s of the Layer. May be a vector ofMultilayerVertex{nothing}
s or a vector ofNode
s. In the latter case, the metadata of theMultilayerVertex
to be added are computed via thedefault_vertex_metadata
before the vertex is added (the function will act on each element ofMV.(vertices)
);ne::Int64
: The number of edges of the Layer;default_edge_weight::Function
: Function that takes a pair ofMultilayerVertex
s and returns an edge weight of typeweighttype
ornothing
(which is compatible with unweighted underlying graphs and corresponds toone(weighttype)
for weighted underlying graphs). Defaults to(src, dst) -> nothing
;vertextype::Type{T} = Int64
: The type of the underlying integer labels associated to vertices.weighttype::Type{U} = Float64
: The type of theMultilayerEdge
weights (even when the underlying Layer's graph is unweighted, we need to specify a weight type since theMultilayerGraph
s will always be weighted)
MultilayerGraphs.layer_simpleweighteddigraph
— Functionlayer_simpleweighteddigraph(
name::Symbol,
vertices::Union{Vector{MultilayerVertex{nothing}},Vector{Node}},
edge_list::Union{Vector{<:MultilayerEdge}, Vector{NTuple{2, MultilayerVertex{nothing}}}};
default_edge_weight::Function = (src,dst) -> nothing,
vertextype::Type{T} = Int64,
weighttype::Type{U} = Float64
) where {T<:Integer,U<:Real}
Constructor for a Layer
whose underlying graph is a SimpleWeightedDiGraph
from SimpleWeightedGraphs.jl
.
ARGUMENTS
name::Symbol
: The name of the Layer;vertices::Union{Vector{MultilayerVertex{nothing}},Vector{Node}}
: TheMultilayerVertex
s of the Layer. May be a vector ofMultilayerVertex{nothing}
s or a vector ofNode
s. In the latter case, the metadata of theMultilayerVertex
to be added are computed via thedefault_vertex_metadata
before the vertex is added (the function will act on each element ofMV.(vertices)
);edge_list::Union{Vector{<:MultilayerEdge}, Vector{NTuple{2, MultilayerVertex{nothing}}}}
: The list ofMultilayerEdge
s. It may be a vector ofMultilayerEdge
s or a Vector of 2-tuples ofMultilayerVertex
s. In the latter case, the weight and the metadata of theMultilayerEdge
to be added are computed respectively via thedefault_edge_weight
anddefault_edge_metadata
functions;default_edge_weight::Function
: Function that takes a pair ofMultilayerVertex
s and returns an edge weight of typeweighttype
ornothing
(which is compatible with unweighted underlying graphs and corresponds toone(weighttype)
for weighted underlying graphs). Defaults to(src, dst) -> nothing
;vertextype::Type{T} = Int64
: The type of the underlying integer labels associated to vertices.weighttype::Type{U} = Float64
: The type of theMultilayerEdge
weights (even when the underlying Layer's graph is unweighted, we need to specify a weight type since theMultilayerGraph
s will always be weighted)
layer_simpleweighteddigraph(
name::Symbol,
vertices::Union{Vector{MultilayerVertex{nothing}},Vector{Node}},
indegree_distribution::UnivariateDistribution,
outdegree_distribution::UnivariateDistribution;
default_edge_weight::Function = (src,dst) -> nothing,
vertextype::Type{T} = Int64,
weighttype::Type{U} = Float64
) where {T<:Integer,U<:Real}
Constructor for a Layer
whose underlying graph is a SimpleWeightedDiGraph
from SimpleWeightedGraphs.jl
, with a indegree and outdegree sequences respectively sampled from indegree_distribution
and outdegree_distribution
. Realization is performed via the Kleitman-Wang algorithm.
ARGUMENTS
name::Symbol
: The name of the Layer;vertices::Union{Vector{MultilayerVertex{nothing}},Vector{Node}}
: TheMultilayerVertex
s of the Layer. May be a vector ofMultilayerVertex{nothing}
s or a vector ofNode
s. In the latter case, the metadata of theMultilayerVertex
to be added are computed via thedefault_vertex_metadata
before the vertex is added (the function will act on each element ofMV.(vertices)
);indegree_distribution::UnivariateDistribution
: The degree distribution from which the indegree sequence is sampled ;outdegree_distribution::UnivariateDistribution
: The degree distribution from which the outdegree sequence is sampled ;default_edge_weight::Function
: Function that takes a pair ofMultilayerVertex
s and returns an edge weight of typeweighttype
ornothing
(which is compatible with unweighted underlying graphs and corresponds toone(weighttype)
for weighted underlying graphs). Defaults to(src, dst) -> nothing
;vertextype::Type{T} = Int64
: The type of the underlying integer labels associated to vertices.weighttype::Type{U} = Float64
: The type of theMultilayerEdge
weights (even when the underlying Layer's graph is unweighted, we need to specify a weight type since theMultilayerGraph
s will always be weighted)
layer_simpleweighteddigraph(
name::Symbol,
vertices::Union{Vector{MultilayerVertex{nothing}},Vector{Node}},
ne::Int64;
default_edge_weight::Function = (src,dst) -> nothing,
vertextype::Type{T} = Int64,
weighttype::Type{U} = Float64
) where {T<:Integer,U<:Real}
Return a random Layer
with ne
edges whose underlying graph is a SimpleWeightedDiGraph
from SimpleWeightedGraphs.jl
, with a indegree and outdegree sequences respectively sampled from indegree_distribution
and outdegree_distribution
. Realization is performed via the Kleitman-Wang algorithm.
ARGUMENTS
name::Symbol
: The name of the Layer;vertices::Union{Vector{MultilayerVertex{nothing}},Vector{Node}}
: TheMultilayerVertex
s of the Layer. May be a vector ofMultilayerVertex{nothing}
s or a vector ofNode
s. In the latter case, the metadata of theMultilayerVertex
to be added are computed via thedefault_vertex_metadata
before the vertex is added (the function will act on each element ofMV.(vertices)
);ne::Int64
: The number of edges of the Layer;default_edge_weight::Function
: Function that takes a pair ofMultilayerVertex
s and returns an edge weight of typeweighttype
ornothing
(which is compatible with unweighted underlying graphs and corresponds toone(weighttype)
for weighted underlying graphs). Defaults to(src, dst) -> nothing
;vertextype::Type{T} = Int64
: The type of the underlying integer labels associated to vertices.weighttype::Type{U} = Float64
: The type of theMultilayerEdge
weights (even when the underlying Layer's graph is unweighted, we need to specify a weight type since theMultilayerGraph
s will always be weighted)
MultilayerGraphs.layer_metadigraph
— Functionlayer_metadigraph(
name::Symbol,
vertices::Union{Vector{MultilayerVertex{nothing}},Vector{Node}},
edge_list::Union{Vector{<:MultilayerEdge}, Vector{NTuple{2, MultilayerVertex{nothing}}}};
default_vertex_metadata::Function = mv -> NamedTuple(),
default_edge_metadata::Function = (src, dst) -> NamedTuple(),
vertextype::Type{T} = Int64,
weighttype::Type{U} = Float64
) where {T<:Integer,U<:Real}
Constructor for a Layer
whose underlying graph is a MetaDiGraph
from MetaGraphs.jl
.
ARGUMENTS
name::Symbol
: The name of the Layer;vertices::Union{Vector{MultilayerVertex{nothing}},Vector{Node}}
: TheMultilayerVertex
s of the Layer. May be a vector ofMultilayerVertex{nothing}
s or a vector ofNode
s. In the latter case, the metadata of theMultilayerVertex
to be added are computed via thedefault_vertex_metadata
before the vertex is added (the function will act on each element ofMV.(vertices)
);edge_list::Union{Vector{<:MultilayerEdge}, Vector{NTuple{2, MultilayerVertex{nothing}}}}
: The list ofMultilayerEdge
s. It may be a vector ofMultilayerEdge
s or a Vector of 2-tuples ofMultilayerVertex
s. In the latter case, the weight and the metadata of theMultilayerEdge
to be added are computed respectively via thedefault_edge_weight
anddefault_edge_metadata
functions;
KWARGS
-default_vertex_metadata::Function
: Function that takes a MultilayerVertex
and returns a Tuple
or a NamedTuple
containing the vertex metadata. defaults to mv -> NamedTuple()
;
default_edge_metadata::Function
: Function that takes a pair ofMultilayerVertex
s and returns aTuple
or aNamedTuple
containing the edge metadata, that will be called whenadd_edge!(mg,src,dst, args...; kwargs...)
is called without themetadata
keyword argument, and when generating the edges in this constructor. Defaults to(src, dst) -> NamedTuple()
vertextype::Type{T} = Int64
: The type of the underlying integer labels associated to vertices.weighttype::Type{U} = Float64
: The type of theMultilayerEdge
weights (even when the underlying Layer's graph is unweighted, we need to specify a weight type since theMultilayerGraph
s will always be weighted)
layer_metadigraph(
name::Symbol,
vertices::Union{Vector{MultilayerVertex{nothing}},Vector{Node}},
indegree_distribution::UnivariateDistribution,
outdegree_distribution::UnivariateDistribution;
default_vertex_metadata::Function = mv -> NamedTuple(),
default_edge_metadata::Function = (src, dst) -> NamedTuple(),
vertextype::Type{T} = Int64,
weighttype::Type{U} = Float64
) where {T<:Integer,U<:Real}
Constructor for a Layer
whose underlying graph is a MetaDiGraph
from MetaDiGraphs.jl
with a indegree and outdegree sequences respectively sampled from indegree_distribution
and outdegree_distribution
. Realization is performed via the Kleitman-Wang algorithm.
ARGUMENTS
name::Symbol
: The name of the Layer;vertices::Union{Vector{MultilayerVertex{nothing}},Vector{Node}}
: TheMultilayerVertex
s of the Layer. May be a vector ofMultilayerVertex{nothing}
s or a vector ofNode
s. In the latter case, the metadata of theMultilayerVertex
to be added are computed via thedefault_vertex_metadata
before the vertex is added (the function will act on each element ofMV.(vertices)
);indegree_distribution::UnivariateDistribution
: The degree distribution from which the indegree sequence is sampled ;outdegree_distribution::UnivariateDistribution
: The degree distribution from which the outdegree sequence is sampled ;
KWARGS
-default_vertex_metadata::Function
: Function that takes a MultilayerVertex
and returns a Tuple
or a NamedTuple
containing the vertex metadata. defaults to mv -> NamedTuple()
;
default_edge_metadata::Function
: Function that takes a pair ofMultilayerVertex
s and returns aTuple
or aNamedTuple
containing the edge metadata, that will be called whenadd_edge!(mg,src,dst, args...; kwargs...)
is called without themetadata
keyword argument, and when generating the edges in this constructor. Defaults to(src, dst) -> NamedTuple()
vertextype::Type{T} = Int64
: The type of the underlying integer labels associated to vertices.weighttype::Type{U} = Float64
: The type of theMultilayerEdge
weights (even when the underlying Layer's graph is unweighted, we need to specify a weight type since theMultilayerGraph
s will always be weighted)
layer_metadigraph(
name::Symbol,
vertices::Union{Vector{MultilayerVertex{nothing}},Vector{Node}},
ne::Int64;
default_vertex_metadata::Function = mv -> NamedTuple(),
default_edge_metadata::Function = (src, dst) -> NamedTuple(),
vertextype::Type{T} = Int64,
weighttype::Type{U} = Float64
) where {T<:Integer,U<:Real}
Return a random Layer
with ne
edges whose underlying graph is a MetaDiGraph
from MetaDiGraphs.jl
with a indegree and outdegree sequences respectively sampled from indegree_distribution
and outdegree_distribution
. Realization is performed via the Kleitman-Wang algorithm.
ARGUMENTS
name::Symbol
: The name of the Layer;vertices::Union{Vector{MultilayerVertex{nothing}},Vector{Node}}
: TheMultilayerVertex
s of the Layer. May be a vector ofMultilayerVertex{nothing}
s or a vector ofNode
s. In the latter case, the metadata of theMultilayerVertex
to be added are computed via thedefault_vertex_metadata
before the vertex is added (the function will act on each element ofMV.(vertices)
);ne::Int64
: The number of edges of the Layer;
KWARGS
-default_vertex_metadata::Function
: Function that takes a MultilayerVertex
and returns a Tuple
or a NamedTuple
containing the vertex metadata. defaults to mv -> NamedTuple()
;
default_edge_metadata::Function
: Function that takes a pair ofMultilayerVertex
s and returns aTuple
or aNamedTuple
containing the edge metadata, that will be called whenadd_edge!(mg,src,dst, args...; kwargs...)
is called without themetadata
keyword argument, and when generating the edges in this constructor. Defaults to(src, dst) -> NamedTuple()
vertextype::Type{T} = Int64
: The type of the underlying integer labels associated to vertices.weighttype::Type{U} = Float64
: The type of theMultilayerEdge
weights (even when the underlying Layer's graph is unweighted, we need to specify a weight type since theMultilayerGraph
s will always be weighted)
MultilayerGraphs.layer_valgraph
— Functionlayer_valgraph(
name::Symbol,
vertices::Union{Vector{MultilayerVertex{nothing}},Vector{Node}},
edge_list::Union{Vector{<:MultilayerEdge}, Vector{NTuple{2, MultilayerVertex{nothing}}}};
default_vertex_metadata::Function = mv -> NamedTuple(),
default_edge_metadata::Function = (src, dst) -> NamedTuple(),
vertextype::Type{T} = Int64,
weighttype::Type{U} = Float64
) where {T<:Integer,U<:Real}
Constructor for a Layer
whose underlying graph is a ValGraph
from SimpleValueGraphs.jl
.
ARGUMENTS
name::Symbol
: The name of the Layer;vertices::Union{Vector{MultilayerVertex{nothing}},Vector{Node}}
: TheMultilayerVertex
s of the Layer. May be a vector ofMultilayerVertex{nothing}
s or a vector ofNode
s. In the latter case, the metadata of theMultilayerVertex
to be added are computed via thedefault_vertex_metadata
before the vertex is added (the function will act on each element ofMV.(vertices)
);edge_list::Union{Vector{<:MultilayerEdge}, Vector{NTuple{2, MultilayerVertex{nothing}}}}
: The list ofMultilayerEdge
s. It may be a vector ofMultilayerEdge
s or a Vector of 2-tuples ofMultilayerVertex
s. In the latter case, the weight and the metadata of theMultilayerEdge
to be added are computed respectively via thedefault_edge_weight
anddefault_edge_metadata
functions;
KWARGS
-default_vertex_metadata::Function
: Function that takes a MultilayerVertex
and returns a Tuple
or a NamedTuple
containing the vertex metadata. defaults to mv -> NamedTuple()
;
default_edge_metadata::Function
: Function that takes a pair ofMultilayerVertex
s and returns aTuple
or aNamedTuple
containing the edge metadata, that will be called whenadd_edge!(mg,src,dst, args...; kwargs...)
is called without themetadata
keyword argument, and when generating the edges in this constructor. Defaults to(src, dst) -> NamedTuple()
vertextype::Type{T} = Int64
: The type of the underlying integer labels associated to vertices.weighttype::Type{U} = Float64
: The type of theMultilayerEdge
weights (even when the underlying Layer's graph is unweighted, we need to specify a weight type since theMultilayerGraph
s will always be weighted)
layer_valgraph(
name::Symbol,
vertices::Union{Vector{MultilayerVertex{nothing}},Vector{Node}},
degree_distribution::UnivariateDistribution;
default_vertex_metadata::Function = mv -> NamedTuple(),
default_edge_metadata::Function = (src, dst) -> NamedTuple(),
vertextype::Type{T} = Int64,
weighttype::Type{U} = Float64
) where {T<:Integer,U<:Real}
Constructor for a Layer
whose underlying graph is a ValGraph
from SimpleValueGraphs.jl
. with a degree sequence sampled from degree_distribution
. Realization is performed via the Havel-Hakimi algorithm.
ARGUMENTS
name::Symbol
: The name of the Layer;vertices::Union{Vector{MultilayerVertex{nothing}},Vector{Node}}
: TheMultilayerVertex
s of the Layer. May be a vector ofMultilayerVertex{nothing}
s or a vector ofNode
s. In the latter case, the metadata of theMultilayerVertex
to be added are computed via thedefault_vertex_metadata
before the vertex is added (the function will act on each element ofMV.(vertices)
);degree_distribution::UnivariateDistribution
: The degree distribution from which the degree sequence is sampled ;
KWARGS
-default_vertex_metadata::Function
: Function that takes a MultilayerVertex
and returns a Tuple
or a NamedTuple
containing the vertex metadata. defaults to mv -> NamedTuple()
;
default_edge_metadata::Function
: Function that takes a pair ofMultilayerVertex
s and returns aTuple
or aNamedTuple
containing the edge metadata, that will be called whenadd_edge!(mg,src,dst, args...; kwargs...)
is called without themetadata
keyword argument, and when generating the edges in this constructor. Defaults to(src, dst) -> NamedTuple()
vertextype::Type{T} = Int64
: The type of the underlying integer labels associated to vertices.weighttype::Type{U} = Float64
: The type of theMultilayerEdge
weights (even when the underlying Layer's graph is unweighted, we need to specify a weight type since theMultilayerGraph
s will always be weighted)
layer_valgraph(
name::Symbol,
vertices::Union{Vector{MultilayerVertex{nothing}},Vector{Node}},
ne::Int64;
default_vertex_metadata::Function = mv -> NamedTuple(),
default_edge_metadata::Function = (src, dst) -> NamedTuple(),
vertextype::Type{T} = Int64,
weighttype::Type{U} = Float64
) where {T<:Integer,U<:Real}
Return a random Layer
with ne
edges whose underlying graph is a ValGraph
from SimpleValueGraphs.jl
. with a degree sequence sampled from degree_distribution
. Realization is performed via the Havel-Hakimi algorithm.
ARGUMENTS
name::Symbol
: The name of the Layer;vertices::Union{Vector{MultilayerVertex{nothing}},Vector{Node}}
: TheMultilayerVertex
s of the Layer. May be a vector ofMultilayerVertex{nothing}
s or a vector ofNode
s. In the latter case, the metadata of theMultilayerVertex
to be added are computed via thedefault_vertex_metadata
before the vertex is added (the function will act on each element ofMV.(vertices)
);ne::Int64
: The number of edges of the Layer;
KWARGS
-default_vertex_metadata::Function
: Function that takes a MultilayerVertex
and returns a Tuple
or a NamedTuple
containing the vertex metadata. defaults to mv -> NamedTuple()
;
default_edge_metadata::Function
: Function that takes a pair ofMultilayerVertex
s and returns aTuple
or aNamedTuple
containing the edge metadata, that will be called whenadd_edge!(mg,src,dst, args...; kwargs...)
is called without themetadata
keyword argument, and when generating the edges in this constructor. Defaults to(src, dst) -> NamedTuple()
vertextype::Type{T} = Int64
: The type of the underlying integer labels associated to vertices.weighttype::Type{U} = Float64
: The type of theMultilayerEdge
weights (even when the underlying Layer's graph is unweighted, we need to specify a weight type since theMultilayerGraph
s will always be weighted)
MultilayerGraphs.layer_valoutdigraph
— Functionlayer_valoutdigraph(
name::Symbol,
vertices::Union{Vector{MultilayerVertex{nothing}},Vector{Node}},
edge_list::Union{Vector{<:MultilayerEdge}, Vector{NTuple{2, MultilayerVertex{nothing}}}};
default_vertex_metadata::Function = mv -> NamedTuple(),
default_edge_metadata::Function = (src, dst) -> NamedTuple(),
vertextype::Type{T} = Int64,
weighttype::Type{U} = Float64
) where {T<:Integer,U<:Real}
Constructor for a Layer
whose underlying graph is a ValOutDiGraph
from SimpleValueGraphs.jl
.
ARGUMENTS
name::Symbol
: The name of the Layer;vertices::Union{Vector{MultilayerVertex{nothing}},Vector{Node}}
: TheMultilayerVertex
s of the Layer. May be a vector ofMultilayerVertex{nothing}
s or a vector ofNode
s. In the latter case, the metadata of theMultilayerVertex
to be added are computed via thedefault_vertex_metadata
before the vertex is added (the function will act on each element ofMV.(vertices)
);edge_list::Union{Vector{<:MultilayerEdge}, Vector{NTuple{2, MultilayerVertex{nothing}}}}
: The list ofMultilayerEdge
s. It may be a vector ofMultilayerEdge
s or a Vector of 2-tuples ofMultilayerVertex
s. In the latter case, the weight and the metadata of theMultilayerEdge
to be added are computed respectively via thedefault_edge_weight
anddefault_edge_metadata
functions;
KWARGS
-default_vertex_metadata::Function
: Function that takes a MultilayerVertex
and returns a Tuple
or a NamedTuple
containing the vertex metadata. defaults to mv -> NamedTuple()
;
default_edge_metadata::Function
: Function that takes a pair ofMultilayerVertex
s and returns aTuple
or aNamedTuple
containing the edge metadata, that will be called whenadd_edge!(mg,src,dst, args...; kwargs...)
is called without themetadata
keyword argument, and when generating the edges in this constructor. Defaults to(src, dst) -> NamedTuple()
vertextype::Type{T} = Int64
: The type of the underlying integer labels associated to vertices.weighttype::Type{U} = Float64
: The type of theMultilayerEdge
weights (even when the underlying Layer's graph is unweighted, we need to specify a weight type since theMultilayerGraph
s will always be weighted)
layer_valoutdigraph(
name::Symbol,
vertices::Union{Vector{MultilayerVertex{nothing}},Vector{Node}},
indegree_distribution::UnivariateDistribution,
outdegree_distribution::UnivariateDistribution;
default_vertex_metadata::Function = mv -> NamedTuple(),
default_edge_metadata::Function = (src, dst) -> NamedTuple(),
vertextype::Type{T} = Int64,
weighttype::Type{U} = Float64
) where {T<:Integer,U<:Real}
Constructor for a Layer
whose underlying graph is a ValOutDiGraph
from SimpleValueGraphs.jl
with a indegree and outdegree sequences respectively sampled from indegree_distribution
and outdegree_distribution
. Realization is performed via the Kleitman-Wang algorithm.
ARGUMENTS
name::Symbol
: The name of the Layer;vertices::Union{Vector{MultilayerVertex{nothing}},Vector{Node}}
: TheMultilayerVertex
s of the Layer. May be a vector ofMultilayerVertex{nothing}
s or a vector ofNode
s. In the latter case, the metadata of theMultilayerVertex
to be added are computed via thedefault_vertex_metadata
before the vertex is added (the function will act on each element ofMV.(vertices)
);indegree_distribution::UnivariateDistribution
: The degree distribution from which the indegree sequence is sampled ;outdegree_distribution::UnivariateDistribution
: The degree distribution from which the outdegree sequence is sampled ;
KWARGS
-default_vertex_metadata::Function
: Function that takes a MultilayerVertex
and returns a Tuple
or a NamedTuple
containing the vertex metadata. defaults to mv -> NamedTuple()
. Do not type this function's arguments;
default_edge_metadata::Function
: Function that takes a pair ofMultilayerVertex
s and returns aTuple
or aNamedTuple
containing the edge metadata, that will be called whenadd_edge!(mg,src,dst, args...; kwargs...)
is called without themetadata
keyword argument, and when generating the edges in this constructor. Defaults to(src, dst) -> NamedTuple()
, Do not type this function's arguments;vertextype::Type{T} = Int64
: The type of the underlying integer labels associated to vertices.weighttype::Type{U} = Float64
: The type of theMultilayerEdge
weights (even when the underlying Layer's graph is unweighted, we need to specify a weight type since theMultilayerGraph
s will always be weighted)
layer_valoutdigraph(
name::Symbol,
vertices::Union{Vector{MultilayerVertex{nothing}},Vector{Node}},
ne::Int64;
default_vertex_metadata::Function = mv -> NamedTuple(),
default_edge_metadata::Function = (src, dst) -> NamedTuple(),
vertextype::Type{T} = Int64,
weighttype::Type{U} = Float64
) where {T<:Integer,U<:Real}
Return a random Layer
with ne
edges whose underlying graph is a ValOutDiGraph
from SimpleValueGraphs.jl
with a indegree and outdegree sequences respectively sampled from indegree_distribution
and outdegree_distribution
. Realization is performed via the Kleitman-Wang algorithm.
ARGUMENTS
name::Symbol
: The name of the Layer;vertices::Union{Vector{MultilayerVertex{nothing}},Vector{Node}}
: TheMultilayerVertex
s of the Layer. May be a vector ofMultilayerVertex{nothing}
s or a vector ofNode
s. In the latter case, the metadata of theMultilayerVertex
to be added are computed via thedefault_vertex_metadata
before the vertex is added (the function will act on each element ofMV.(vertices)
);ne::Int64
: The number of edges of the Layer;
KWARGS
-default_vertex_metadata::Function
: Function that takes a MultilayerVertex
and returns a Tuple
or a NamedTuple
containing the vertex metadata. defaults to mv -> NamedTuple()
. Do not type this function's arguments;
default_edge_metadata::Function
: Function that takes a pair ofMultilayerVertex
s and returns aTuple
or aNamedTuple
containing the edge metadata, that will be called whenadd_edge!(mg,src,dst, args...; kwargs...)
is called without themetadata
keyword argument, and when generating the edges in this constructor. Defaults to(src, dst) -> NamedTuple()
, Do not type this function's arguments;vertextype::Type{T} = Int64
: The type of the underlying integer labels associated to vertices.weighttype::Type{U} = Float64
: The type of theMultilayerEdge
weights (even when the underlying Layer's graph is unweighted, we need to specify a weight type since theMultilayerGraph
s will always be weighted)
MultilayerGraphs.layer_valdigraph
— Functionlayer_valdigraph(
name::Symbol,
vertices::Union{Vector{MultilayerVertex{nothing}},Vector{Node}},
edge_list::Union{Vector{<:MultilayerEdge}, Vector{NTuple{2, MultilayerVertex{nothing}}}};
default_vertex_metadata::Function = mv -> NamedTuple(),
default_edge_metadata::Function = (src, dst) -> NamedTuple(),
vertextype::Type{T} = Int64,
weighttype::Type{U} = Float64
) where {T<:Integer,U<:Real}
Constructor for a Layer
whose underlying graph is a ValDiGraph
from SimpleValueGraphs.jl
.
ARGUMENTS
name::Symbol
: The name of the Layer;vertices::Union{Vector{MultilayerVertex{nothing}},Vector{Node}}
: TheMultilayerVertex
s of the Layer. May be a vector ofMultilayerVertex{nothing}
s or a vector ofNode
s. In the latter case, the metadata of theMultilayerVertex
to be added are computed via thedefault_vertex_metadata
before the vertex is added (the function will act on each element ofMV.(vertices)
);edge_list::Union{Vector{<:MultilayerEdge}, Vector{NTuple{2, MultilayerVertex{nothing}}}}
: The list ofMultilayerEdge
s. It may be a vector ofMultilayerEdge
s or a Vector of 2-tuples ofMultilayerVertex
s. In the latter case, the weight and the metadata of theMultilayerEdge
to be added are computed respectively via thedefault_edge_weight
anddefault_edge_metadata
functions;
KWARGS
-default_vertex_metadata::Function
: Function that takes a MultilayerVertex
and returns a Tuple
or a NamedTuple
containing the vertex metadata. defaults to mv -> NamedTuple()
;
default_edge_metadata::Function
: Function that takes a pair ofMultilayerVertex
s and returns aTuple
or aNamedTuple
containing the edge metadata, that will be called whenadd_edge!(mg,src,dst, args...; kwargs...)
is called without themetadata
keyword argument, and when generating the edges in this constructor. Defaults to(src, dst) -> NamedTuple()
vertextype::Type{T} = Int64
: The type of the underlying integer labels associated to vertices.weighttype::Type{U} = Float64
: The type of theMultilayerEdge
weights (even when the underlying Layer's graph is unweighted, we need to specify a weight type since theMultilayerGraph
s will always be weighted)
layer_valdigraph(
name::Symbol,
vertices::Union{Vector{MultilayerVertex{nothing}},Vector{Node}},
indegree_distribution::UnivariateDistribution,
outdegree_distribution::UnivariateDistribution;
default_vertex_metadata::Function = mv -> NamedTuple(),
default_edge_metadata::Function = (src, dst) -> NamedTuple(),
vertextype::Type{T} = Int64,
weighttype::Type{U} = Float64
) where {T<:Integer,U<:Real}
Constructor for a Layer
whose underlying graph is a ValDiGraph
from SimpleValueGraphs.jl
with a indegree and outdegree sequences respectively sampled from indegree_distribution
and outdegree_distribution
. Realization is performed via the Kleitman-Wang algorithm.
ARGUMENTS
name::Symbol
: The name of the Layer;vertices::Union{Vector{MultilayerVertex{nothing}},Vector{Node}}
: TheMultilayerVertex
s of the Layer. May be a vector ofMultilayerVertex{nothing}
s or a vector ofNode
s. In the latter case, the metadata of theMultilayerVertex
to be added are computed via thedefault_vertex_metadata
before the vertex is added (the function will act on each element ofMV.(vertices)
);indegree_distribution::UnivariateDistribution
: The degree distribution from which the indegree sequence is sampled ;outdegree_distribution::UnivariateDistribution
: The degree distribution from which the outdegree sequence is sampled ;
KWARGS
-default_vertex_metadata::Function
: Function that takes a MultilayerVertex
and returns a Tuple
or a NamedTuple
containing the vertex metadata. defaults to mv -> NamedTuple()
. Do not type this function's arguments;
default_edge_metadata::Function
: Function that takes a pair ofMultilayerVertex
s and returns aTuple
or aNamedTuple
containing the edge metadata, that will be called whenadd_edge!(mg,src,dst, args...; kwargs...)
is called without themetadata
keyword argument, and when generating the edges in this constructor. Defaults to(src, dst) -> NamedTuple()
, Do not type this function's arguments;vertextype::Type{T} = Int64
: The type of the underlying integer labels associated to vertices.weighttype::Type{U} = Float64
: The type of theMultilayerEdge
weights (even when the underlying Layer's graph is unweighted, we need to specify a weight type since theMultilayerGraph
s will always be weighted)
layer_valdigraph(
name::Symbol,
vertices::Union{Vector{MultilayerVertex{nothing}},Vector{Node}},
ne::Int64;
default_vertex_metadata::Function = mv -> NamedTuple(),
default_edge_metadata::Function = (src, dst) -> NamedTuple(),
vertextype::Type{T} = Int64,
weighttype::Type{U} = Float64
) where {T<:Integer,U<:Real}
Return a random Layer
with ne
edges whose underlying graph is a ValDiGraph
from SimpleValueGraphs.jl
with a indegree and outdegree sequences respectively sampled from indegree_distribution
and outdegree_distribution
. Realization is performed via the Kleitman-Wang algorithm.
ARGUMENTS
name::Symbol
: The name of the Layer;vertices::Union{Vector{MultilayerVertex{nothing}},Vector{Node}}
: TheMultilayerVertex
s of the Layer. May be a vector ofMultilayerVertex{nothing}
s or a vector ofNode
s. In the latter case, the metadata of theMultilayerVertex
to be added are computed via thedefault_vertex_metadata
before the vertex is added (the function will act on each element ofMV.(vertices)
);ne::Int64
: The number of edges of the Layer;
KWARGS
-default_vertex_metadata::Function
: Function that takes a MultilayerVertex
and returns a Tuple
or a NamedTuple
containing the vertex metadata. defaults to mv -> NamedTuple()
. Do not type this function's arguments;
default_edge_metadata::Function
: Function that takes a pair ofMultilayerVertex
s and returns aTuple
or aNamedTuple
containing the edge metadata, that will be called whenadd_edge!(mg,src,dst, args...; kwargs...)
is called without themetadata
keyword argument, and when generating the edges in this constructor. Defaults to(src, dst) -> NamedTuple()
, Do not type this function's arguments;vertextype::Type{T} = Int64
: The type of the underlying integer labels associated to vertices.weighttype::Type{U} = Float64
: The type of theMultilayerEdge
weights (even when the underlying Layer's graph is unweighted, we need to specify a weight type since theMultilayerGraph
s will always be weighted)
MultilayerGraphs.layer_metagraph
— Functionlayer_metagraph(
name::Symbol,
vertices::Union{Vector{MultilayerVertex{nothing}},Vector{Node}},
edge_list::Union{Vector{<:MultilayerEdge}, Vector{NTuple{2, MultilayerVertex{nothing}}}};
default_vertex_metadata::Function = mv -> NamedTuple(),
default_edge_metadata::Function = (src, dst) -> NamedTuple(),
vertextype::Type{T} = Int64,
weighttype::Type{U} = Float64
) where {T<:Integer,U<:Real}
Constructor for a Layer
whose underlying graph is a MetaGraph
from MetaGraphs.jl
.
ARGUMENTS
name::Symbol
: The name of the Layer;vertices::Union{Vector{MultilayerVertex{nothing}},Vector{Node}}
: TheMultilayerVertex
s of the Layer. May be a vector ofMultilayerVertex{nothing}
s or a vector ofNode
s. In the latter case, the metadata of theMultilayerVertex
to be added are computed via thedefault_vertex_metadata
before the vertex is added (the function will act on each element ofMV.(vertices)
);edge_list::Union{Vector{<:MultilayerEdge}, Vector{NTuple{2, MultilayerVertex{nothing}}}}
: The list ofMultilayerEdge
s. It may be a vector ofMultilayerEdge
s or a Vector of 2-tuples ofMultilayerVertex
s. In the latter case, the weight and the metadata of theMultilayerEdge
to be added are computed respectively via thedefault_edge_weight
anddefault_edge_metadata
functions;
KWARGS
-default_vertex_metadata::Function
: Function that takes a MultilayerVertex
and returns a Tuple
or a NamedTuple
containing the vertex metadata. defaults to mv -> NamedTuple()
;
default_edge_metadata::Function
: Function that takes a pair ofMultilayerVertex
s and returns aTuple
or aNamedTuple
containing the edge metadata, that will be called whenadd_edge!(mg,src,dst, args...; kwargs...)
is called without themetadata
keyword argument, and when generating the edges in this constructor. Defaults to(src, dst) -> NamedTuple()
vertextype::Type{T} = Int64
: The type of the underlying integer labels associated to vertices.weighttype::Type{U} = Float64
: The type of theMultilayerEdge
weights (even when the underlying Layer's graph is unweighted, we need to specify a weight type since theMultilayerGraph
s will always be weighted)
layer_metagraph(
name::Symbol,
vertices::Union{Vector{MultilayerVertex{nothing}},Vector{Node}},
degree_distribution::UnivariateDistribution;
default_vertex_metadata::Function = mv -> NamedTuple(),
default_edge_metadata::Function = (src, dst) -> NamedTuple(),
vertextype::Type{T} = Int64,
weighttype::Type{U} = Float64
) where {T<:Integer,U<:Real}
Constructor for a Layer
whose underlying graph is a MetaGraph
from MetaGraphs.jl
with a degree sequence sampled from degree_distribution
. Realization is performed via the Havel-Hakimi algorithm.
ARGUMENTS
name::Symbol
: The name of the Layer;vertices::Union{Vector{MultilayerVertex{nothing}},Vector{Node}}
: TheMultilayerVertex
s of the Layer. May be a vector ofMultilayerVertex{nothing}
s or a vector ofNode
s. In the latter case, the metadata of theMultilayerVertex
to be added are computed via thedefault_vertex_metadata
before the vertex is added (the function will act on each element ofMV.(vertices)
);degree_distribution::UnivariateDistribution
: The degree distribution from which the degree sequence is sampled ;
KWARGS
-default_vertex_metadata::Function
: Function that takes a MultilayerVertex
and returns a Tuple
or a NamedTuple
containing the vertex metadata. defaults to mv -> NamedTuple()
;
default_edge_metadata::Function
: Function that takes a pair ofMultilayerVertex
s and returns aTuple
or aNamedTuple
containing the edge metadata, that will be called whenadd_edge!(mg,src,dst, args...; kwargs...)
is called without themetadata
keyword argument, and when generating the edges in this constructor. Defaults to(src, dst) -> NamedTuple()
vertextype::Type{T} = Int64
: The type of the underlying integer labels associated to vertices.weighttype::Type{U} = Float64
: The type of theMultilayerEdge
weights (even when the underlying Layer's graph is unweighted, we need to specify a weight type since theMultilayerGraph
s will always be weighted)
layer_metagraph(
name::Symbol,
vertices::Union{Vector{MultilayerVertex{nothing}},Vector{Node}},
ne::Int64;
default_vertex_metadata::Function = mv -> NamedTuple(),
default_edge_metadata::Function = (src, dst) -> NamedTuple(),
vertextype::Type{T} = Int64,
weighttype::Type{U} = Float64
) where {T<:Integer,U<:Real}
Return a random Layer
with ne
edges whose underlying graph is a MetaGraph
from MetaGraphs.jl
with a degree sequence sampled from degree_distribution
. Realization is performed via the Havel-Hakimi algorithm.
ARGUMENTS
name::Symbol
: The name of the Layer;vertices::Union{Vector{MultilayerVertex{nothing}},Vector{Node}}
: TheMultilayerVertex
s of the Layer. May be a vector ofMultilayerVertex{nothing}
s or a vector ofNode
s. In the latter case, the metadata of theMultilayerVertex
to be added are computed via thedefault_vertex_metadata
before the vertex is added (the function will act on each element ofMV.(vertices)
);ne::Int64
: The number of edges of the Layer;
KWARGS
-default_vertex_metadata::Function
: Function that takes a MultilayerVertex
and returns a Tuple
or a NamedTuple
containing the vertex metadata. defaults to mv -> NamedTuple()
;
default_edge_metadata::Function
: Function that takes a pair ofMultilayerVertex
s and returns aTuple
or aNamedTuple
containing the edge metadata, that will be called whenadd_edge!(mg,src,dst, args...; kwargs...)
is called without themetadata
keyword argument, and when generating the edges in this constructor. Defaults to(src, dst) -> NamedTuple()
vertextype::Type{T} = Int64
: The type of the underlying integer labels associated to vertices.weighttype::Type{U} = Float64
: The type of theMultilayerEdge
weights (even when the underlying Layer's graph is unweighted, we need to specify a weight type since theMultilayerGraph
s will always be weighted)
MultilayerGraphs.has_node
— Methodhas_node(layer::Layer, n::Node)
Return true
if n
is a node of layer
.
Graphs.SimpleGraphs.add_vertex!
— Methodadd_vertex!(layer::Layer, mv::MultilayerVertex)
Add vertex to layer layer
.
Graphs.SimpleGraphs.add_vertex!
— Methodadd_vertex!(layer::L, n::Node, args...; kwargs...) where {T, L <: Layer{T}}
Add vertex associated with node n
to layer layer
. This method supports the uniform and transparent interfaces. See the Vertices section of the Tutorial.
Graphs.SimpleGraphs.rem_vertex!
— Methodrem_vertex!(layer::Layer, mv::MultilayerVertex)
Remove vertex mv
from layer layer
.
Graphs.SimpleGraphs.rem_vertex!
— Methodrem_vertex!(layer::Layer, n::Node)
Remove node n
from layer
. Modify layer.v_N_associations
according to how rem_vertex!
works in Graph.jl.
MultilayerGraphs.Interlayer
— TypeInterlayer{T<:Integer,U<:Real,G<:AbstractGraph{T}} <: AbstractInterlayer{T,U,G}
Represents an interlayer in a Multilayer(Di)Graph
. Its type hierarchy is: Interlayer <: AbstractInterlayer <: AbstractSubGraph .
MultilayerGraphs.Interlayer
— MethodInterlayer(
layer_1::Layer{T,U},
layer_2::Layer{T,U},
null_graph::G,
edge_list::Vector{ <: MultilayerEdge{<: Union{U, Nothing}}};
default_edge_weight::Function = (x,y) -> nothing,
default_edge_metadata::Function = (x,y) -> NamedTuple(),
transfer_vertex_metadata::Bool = false,
interlayer_name::Symbol
) where {T<:Integer, U <: Real, G<:AbstractGraph{T}}
Constructor for Interlayer.
ARGUMENTS
layer_1::Layer{T,U}
: one of the two layers connected by the Interlayer;layer_2::Layer{T,U}
: one of the two layers connected by the Interlayer;edge_list::Vector{ <: MultilayerEdge{<: Union{U, Nothing}}}
: The list ofMultilayerEdge
s. It may be a vector ofMultilayerEdge
s or a Vector of 2-tuples ofMultilayerVertex
s. In the latter case, the weight and the metadata of theMultilayerEdge
to be added are computed respectively via thedefault_edge_weight
anddefault_edge_metadata
functions;null_graph::G
: the Interlayer's underlying graph type, which must be passed as a null graph. If it is not, an error will be thrown.
KWARGS
default_edge_weight::Function
: Function that takes a pair ofMultilayerVertex
s and returns an edge weight of typeweighttype
ornothing
(which is compatible with unweighted underlying graphs and corresponds toone(weighttype)
for weighted underlying graphs). Defaults to(src, dst) -> nothing
;default_edge_metadata::Function
: Function that takes a pair ofMultilayerVertex
s and returns aTuple
or aNamedTuple
containing the edge metadata, that will be called whenadd_edge!(mg,src,dst, args...; kwargs...)
is called without themetadata
keyword argument, and when generating the edges in this constructor. Defaults to(src, dst) -> NamedTuple()
;interlayer_name::Symbol
: The name of the Interlayer. Defaults to Symbol("interlayer(layer1.name)(layer2.name)");transfer_vertex_metadata::Bool
: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.
MultilayerGraphs.Interlayer
— MethodInterlayer(
layer_1::Layer{T,U},
layer_2::Layer{T,U},
ne::Int64,
null_graph::G;
default_edge_weight::Function = (x,y) -> nothing,
default_edge_metadata::Function = (x,y) -> NamedTuple(),
interlayer_name::Symbol,
transfer_vertex_metadata::Bool = false
) where {T<:Integer, U <: Union{Nothing, <: Real}, G<:AbstractGraph{T}}
Return a random Interlayer
.
ARGUMENTS
layer_1::Layer{T,U}
: one of the two layers connected by the Interlayer;layer_2::Layer{T,U}
: one of the two layers connected by the Interlayer;ne::Int64
: The number of edges of the Interlayer;null_graph::G
: the Interlayer's underlying graph type, which must be passed as a null graph. If it is not, an error will be thrown.
KWARGS
default_edge_weight::Function
: Function that takes a pair ofMultilayerVertex
s and returns an edge weight of typeweighttype
ornothing
(which is compatible with unweighted underlying graphs and corresponds toone(weighttype)
for weighted underlying graphs). Defaults to(src, dst) -> nothing
;default_edge_metadata::Function
: Function that takes a pair ofMultilayerVertex
s and returns aTuple
or aNamedTuple
containing the edge metadata, that will be called whenadd_edge!(mg,src,dst, args...; kwargs...)
is called without themetadata
keyword argument, and when generating the edges in this constructor. Defaults to(src, dst) -> NamedTuple()
;interlayer_name::Symbol
: The name of the Interlayer. Defaults to Symbol("interlayer(layer1.name)(layer2.name)");transfer_vertex_metadata::Bool
: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.
MultilayerGraphs.interlayer_simplegraph
— Functioninterlayer_simplegraph(
layer_1::Layer{T,U},
layer_2::Layer{T,U},
edge_list::Union{<:Vector{<:MultilayerEdge{<:Union{U, Nothing}}}, Vector{ <:Tuple{<:MultilayerVertex, <:MultilayerVertex}}};
interlayer_name::Symbol
) where {T<:Integer, U <: Real, G<:AbstractGraph{T}}
Constructor for Interlayer whose underlying graph is a SimpleGraph
from Graphs.jl
, with vertex type T
and weight type U
.
ARGUMENTS
layer_1::Layer{T,U}
: one of the two layers connected by the Interlayer;layer_2::Layer{T,U}
: one of the two layers connected by the Interlayer;edge_list::Union{<:Vector{<:MultilayerEdge{ <: Union{U,Nothing}}}, <:Vector{ <: Tuple{<:MultilayerVertex, <:MultilayerVertex}}}
: The list ofMultilayerEdge
s. It may be a vector ofMultilayerEdge
s or a Vector of 2-tuples ofMultilayerVertex
s. In the latter case, the weight and the metadata of theMultilayerEdge
to be added are computed respectively via thedefault_edge_weight
anddefault_edge_metadata
functions;
KWARGS
interlayer_name::Symbol
: The name of the Interlayer. Defaults to Symbol("interlayer(layer1.name)(layer2.name)");
interlayer_simplegraph(
layer_1::Layer{T,U},
layer_2::Layer{T,U},
ne::Int64;
interlayer_name::Symbol
) where {T<:Integer, U <: Real, G<:AbstractGraph{T}}
Return a random Interlayer with ne
edges whose underlying graph is a SimpleGraph
from Graphs.jl
, with vertex type T
and weight type U
.
ARGUMENTS
layer_1::Layer{T,U}
: one of the two layers connected by the Interlayer;layer_2::Layer{T,U}
: one of the two layers connected by the Interlayer;ne::Int64
: The number of edges of the Interlayer;
KWARGS
interlayer_name::Symbol
: The name of the Interlayer. Defaults to Symbol("interlayer(layer1.name)(layer2.name)");
MultilayerGraphs.interlayer_simpleweightedgraph
— Functioninterlayer_simpleweightedgraph(
layer_1::Layer{T,U},
layer_2::Layer{T,U},
edge_list::Union{<:Vector{<:MultilayerEdge{ <: Union{U,Nothing}}}, <:Vector{ <: Tuple{<:MultilayerVertex, <:MultilayerVertex}}};
default_edge_weight::Function=(x, y) -> nothing,
interlayer_name::Symbol
) where {T<:Integer, U <: Real, G<:AbstractGraph{T}}
Constructor for Interlayer whose underlying graph is a SimpleWeightedGraph
from SimpleWeightedGraphs.jl
, with vertex type T
and weight type U
.
ARGUMENTS
layer_1::Layer{T,U}
: one of the two layers connected by the Interlayer;layer_2::Layer{T,U}
: one of the two layers connected by the Interlayer;edge_list::Union{<:Vector{<:MultilayerEdge{ <: Union{U,Nothing}}}, <:Vector{ <: Tuple{<:MultilayerVertex, <:MultilayerVertex}}}
: The list ofMultilayerEdge
s. It may be a vector ofMultilayerEdge
s or a Vector of 2-tuples ofMultilayerVertex
s. In the latter case, the weight and the metadata of theMultilayerEdge
to be added are computed respectively via thedefault_edge_weight
anddefault_edge_metadata
functions;
KWARGS
default_edge_weight::Function
: Function that takes a pair ofMultilayerVertex
s and returns an edge weight of typeweighttype
ornothing
(which is compatible with unweighted underlying graphs and corresponds toone(weighttype)
for weighted underlying graphs). Defaults to(src, dst) -> nothing
;interlayer_name::Symbol
: The name of the Interlayer. Defaults to Symbol("interlayer(layer1.name)(layer2.name)");
interlayer_simpleweightedgraph(
layer_1::Layer{T,U},
layer_2::Layer{T,U},
ne::Int64;
default_edge_weight::Function=(x, y) -> nothing,
interlayer_name::Symbol
) where {T<:Integer, U <: Real, G<:AbstractGraph{T}}
Return a random Interlayer with ne
edges whose underlying graph is a SimpleWeightedGraph
from SimpleWeightedGraphs.jl
, with vertex type T
and weight type U
.
ARGUMENTS
layer_1::Layer{T,U}
: one of the two layers connected by the Interlayer;layer_2::Layer{T,U}
: one of the two layers connected by the Interlayer;ne::Int64
: The number of edges of the Interlayer;
KWARGS
default_edge_weight::Function
: Function that takes a pair ofMultilayerVertex
s and returns an edge weight of typeweighttype
ornothing
(which is compatible with unweighted underlying graphs and corresponds toone(weighttype)
for weighted underlying graphs). Defaults to(src, dst) -> nothing
;interlayer_name::Symbol
: The name of the Interlayer. Defaults to Symbol("interlayer(layer1.name)(layer2.name)");
MultilayerGraphs.interlayer_metagraph
— Functioninterlayer_metagraph(
layer_1::Layer{T,U},
layer_2::Layer{T,U},
edge_list::Union{<:Vector{<:MultilayerEdge{ <: Union{U,Nothing}}}, <:Vector{ <: Tuple{<:MultilayerVertex, <:MultilayerVertex}}};
default_edge_metadata::Function=(x, y) -> NamedTuple(),
transfer_vertex_metadata::Bool=false,
interlayer_name::Symbol
) where {T<:Integer, U <: Real, G<:AbstractGraph{T}}
Constructor for Interlayer whose underlying graph is a MetaGraph
from MetaGraphs.jl
, with vertex type T
and weight type U
.
ARGUMENTS
layer_1::Layer{T,U}
: one of the two layers connected by the Interlayer;layer_2::Layer{T,U}
: one of the two layers connected by the Interlayer;edge_list::Union{<:Vector{<:MultilayerEdge{ <: Union{U,Nothing}}}, <:Vector{ <: Tuple{<:MultilayerVertex, <:MultilayerVertex}}}
: The list ofMultilayerEdge
s. It may be a vector ofMultilayerEdge
s or a Vector of 2-tuples ofMultilayerVertex
s. In the latter case, the weight and the metadata of theMultilayerEdge
to be added are computed respectively via thedefault_edge_weight
anddefault_edge_metadata
functions;
KWARGS
default_edge_metadata::Function
: Function that takes a pair ofMultilayerVertex
s and returns aTuple
or aNamedTuple
containing the edge metadata, that will be called whenadd_edge!(mg,src,dst, args...; kwargs...)
is called without themetadata
keyword argument, and when generating the edges in this constructor. Defaults to(src, dst) -> NamedTuple()
;transfer_vertex_metadata::Bool
: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;interlayer_name::Symbol
: The name of the Interlayer. Defaults to Symbol("interlayer(layer1.name)(layer2.name)");
interlayer_metagraph(
layer_1::Layer{T,U},
layer_2::Layer{T,U},
ne::Int64;
default_edge_metadata::Function=(x, y) -> NamedTuple(),
transfer_vertex_metadata::Bool=false,
interlayer_name::Symbol
) where {T<:Integer, U <: Real, G<:AbstractGraph{T}}
Return a random Interlayer with ne
edges whose underlying graph is a MetaGraph
from MetaGraphs.jl
, with vertex type T
and weight type U
.
ARGUMENTS
layer_1::Layer{T,U}
: one of the two layers connected by the Interlayer;layer_2::Layer{T,U}
: one of the two layers connected by the Interlayer;ne::Int64
: The number of edges of the Interlayer;
KWARGS
default_edge_metadata::Function
: Function that takes a pair ofMultilayerVertex
s and returns aTuple
or aNamedTuple
containing the edge metadata, that will be called whenadd_edge!(mg,src,dst, args...; kwargs...)
is called without themetadata
keyword argument, and when generating the edges in this constructor. Defaults to(src, dst) -> NamedTuple()
;transfer_vertex_metadata::Bool
: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;interlayer_name::Symbol
: The name of the Interlayer. Defaults to Symbol("interlayer(layer1.name)(layer2.name)");
MultilayerGraphs.interlayer_valgraph
— Functioninterlayer_valgraph(
layer_1::Layer{T,U},
layer_2::Layer{T,U},
edge_list::Union{<:Vector{<:MultilayerEdge{ <: Union{U,Nothing}}}, <:Vector{ <: Tuple{<:MultilayerVertex, <:MultilayerVertex}}};
default_edge_metadata::Function=(x, y) -> NamedTuple()
interlayer_name::Symbol
) where {T<:Integer, U <: Real, G<:AbstractGraph{T}}
Constructor for Interlayer whose underlying graph is a ValGraph
from SimpleValueGraphs.jl
, with vertex type T
. By default, transfer_vertex_metadata
is set to false
.
ARGUMENTS
layer_1::Layer{T,U}
: one of the two layers connected by the Interlayer;layer_2::Layer{T,U}
: one of the two layers connected by the Interlayer;edge_list::Union{<:Vector{<:MultilayerEdge{ <: Union{U,Nothing}}}, <:Vector{ <: Tuple{<:MultilayerVertex, <:MultilayerVertex}}}
: The list ofMultilayerEdge
s. It may be a vector ofMultilayerEdge
s or a Vector of 2-tuples ofMultilayerVertex
s. In the latter case, the weight and the metadata of theMultilayerEdge
to be added are computed respectively via thedefault_edge_weight
anddefault_edge_metadata
functions;
KWARGS
default_edge_metadata::Function
: Function that takes a pair ofMultilayerVertex
s and returns aTuple
or aNamedTuple
containing the edge metadata, that will be called whenadd_edge!(mg,src,dst, args...; kwargs...)
is called without themetadata
keyword argument, and when generating the edges in this constructor. Defaults to(src, dst) -> NamedTuple()
;interlayer_name::Symbol
: The name of the Interlayer. Defaults to Symbol("interlayer(layer1.name)(layer2.name)");
interlayer_valgraph(
layer_1::Layer{T,U},
layer_2::Layer{T,U},
ne::Int64;
default_edge_metadata::Function=(x, y) -> NamedTuple()
interlayer_name::Symbol
) where {T<:Integer, U <: Real, G<:AbstractGraph{T}}
Return a random Interlayer with ne
edges whose underlying graph is a ValGraph
from SimpleValueGraphs.jl
, with vertex type T
. By default, transfer_vertex_metadata
is set to false
.
ARGUMENTS
layer_1::Layer{T,U}
: one of the two layers connected by the Interlayer;layer_2::Layer{T,U}
: one of the two layers connected by the Interlayer;ne::Int64
: The number of edges of the Interlayer;
KWARGS
default_edge_metadata::Function
: Function that takes a pair ofMultilayerVertex
s and returns aTuple
or aNamedTuple
containing the edge metadata, that will be called whenadd_edge!(mg,src,dst, args...; kwargs...)
is called without themetadata
keyword argument, and when generating the edges in this constructor. Defaults to(src, dst) -> NamedTuple()
;interlayer_name::Symbol
: The name of the Interlayer. Defaults to Symbol("interlayer(layer1.name)(layer2.name)");
MultilayerGraphs.interlayer_simpledigraph
— Functioninterlayer_simpledigraph(
layer_1::Layer{T,U},
layer_2::Layer{T,U},
edge_list::Union{<:Vector{<:MultilayerEdge{ <: Union{U,Nothing}}}, <:Vector{ <: Tuple{<:MultilayerVertex, <:MultilayerVertex}}};
interlayer_name::Symbol
) where {T<:Integer, U <: Real, G<:AbstractGraph{T}}
Constructor for Interlayer whose underlying graph is a SimpleDiGraph
from Graphs.jl
, with vertex type T
and weight type U
.
ARGUMENTS
layer_1::Layer{T,U}
: one of the two layers connected by the Interlayer;layer_2::Layer{T,U}
: one of the two layers connected by the Interlayer;edge_list::Union{<:Vector{<:MultilayerEdge{ <: Union{U,Nothing}}}, <:Vector{ <: Tuple{<:MultilayerVertex, <:MultilayerVertex}}}
: The list ofMultilayerEdge
s. It may be a vector ofMultilayerEdge
s or a Vector of 2-tuples ofMultilayerVertex
s. In the latter case, the weight and the metadata of theMultilayerEdge
to be added are computed respectively via thedefault_edge_weight
anddefault_edge_metadata
functions;
KWARGS
interlayer_name::Symbol
: The name of the Interlayer. Defaults to Symbol("interlayer(layer1.name)(layer2.name)");
interlayer_simpledigraph(
layer_1::Layer{T,U},
layer_2::Layer{T,U},
ne::Int64;
interlayer_name::Symbol
) where {T<:Integer, U <: Real, G<:AbstractGraph{T}}
Return a random Interlayer with ne
edges whose underlying graph is a SimpleDiGraph
from Graphs.jl
, with vertex type T
and weight type U
.
ARGUMENTS
layer_1::Layer{T,U}
: one of the two layers connected by the Interlayer;layer_2::Layer{T,U}
: one of the two layers connected by the Interlayer;ne::Int64
: The number of edges of the Interlayer;
KWARGS
interlayer_name::Symbol
: The name of the Interlayer. Defaults to Symbol("interlayer(layer1.name)(layer2.name)");
MultilayerGraphs.interlayer_simpleweighteddigraph
— Functioninterlayer_simpleweighteddigraph(
layer_1::Layer{T,U},
layer_2::Layer{T,U},
edge_list::Union{<:Vector{<:MultilayerEdge{ <: Union{U,Nothing}}}, <:Vector{ <: Tuple{<:MultilayerVertex, <:MultilayerVertex}}};
default_edge_weight::Function=(x, y) -> nothing,
interlayer_name::Symbol
) where {T<:Integer, U <: Real, G<:AbstractGraph{T}}
Constructor for Interlayer whose underlying graph is a SimpleWeightedDiGraph
from SimpleWeightedGraphs.jl
, with vertex type T
and weight type U
.
ARGUMENTS
layer_1::Layer{T,U}
: one of the two layers connected by the Interlayer;layer_2::Layer{T,U}
: one of the two layers connected by the Interlayer;edge_list::Union{<:Vector{<:MultilayerEdge{ <: Union{U,Nothing}}}, <:Vector{ <: Tuple{<:MultilayerVertex, <:MultilayerVertex}}}
: The list ofMultilayerEdge
s. It may be a vector ofMultilayerEdge
s or a Vector of 2-tuples ofMultilayerVertex
s. In the latter case, the weight and the metadata of theMultilayerEdge
to be added are computed respectively via thedefault_edge_weight
anddefault_edge_metadata
functions;
KWARGS
default_edge_weight::Function
: Function that takes a pair ofMultilayerVertex
s and returns an edge weight of typeweighttype
ornothing
(which is compatible with unweighted underlying graphs and corresponds toone(weighttype)
for weighted underlying graphs). Defaults to(src, dst) -> nothing
;interlayer_name::Symbol
: The name of the Interlayer. Defaults to Symbol("interlayer(layer1.name)(layer2.name)");
interlayer_simpleweighteddigraph(
layer_1::Layer{T,U},
layer_2::Layer{T,U},
ne::Int64;
default_edge_weight::Function=(x, y) -> nothing,
interlayer_name::Symbol
) where {T<:Integer, U <: Real, G<:AbstractGraph{T}}
Return a random Interlayer with ne
edges underlying graph is a SimpleWeightedDiGraph
from SimpleWeightedGraphs.jl
, with vertex type T
and weight type U
.
ARGUMENTS
layer_1::Layer{T,U}
: one of the two layers connected by the Interlayer;layer_2::Layer{T,U}
: one of the two layers connected by the Interlayer;ne::Int64
: The number of edges of the Interlayer;
KWARGS
default_edge_weight::Function
: Function that takes a pair ofMultilayerVertex
s and returns an edge weight of typeweighttype
ornothing
(which is compatible with unweighted underlying graphs and corresponds toone(weighttype)
for weighted underlying graphs). Defaults to(src, dst) -> nothing
;interlayer_name::Symbol
: The name of the Interlayer. Defaults to Symbol("interlayer(layer1.name)(layer2.name)");
MultilayerGraphs.interlayer_metadigraph
— Functioninterlayer_metadigraph(
layer_1::Layer{T,U},
layer_2::Layer{T,U},
edge_list::Union{<:Vector{<:MultilayerEdge{ <: Union{U,Nothing}}}, <:Vector{ <: Tuple{<:MultilayerVertex, <:MultilayerVertex}}};
default_edge_metadata::Function=(x, y) -> NamedTuple(),
transfer_vertex_metadata::Bool=false,
interlayer_name::Symbol
) where {T<:Integer, U <: Real, G<:AbstractGraph{T}}
Constructor for Interlayer whose underlying graph is a MetaDiGraph
from MetaGraphs.jl
, with vertex type T
and weight type U
.
ARGUMENTS
layer_1::Layer{T,U}
: one of the two layers connected by the Interlayer;layer_2::Layer{T,U}
: one of the two layers connected by the Interlayer;edge_list::Union{<:Vector{<:MultilayerEdge{ <: Union{U,Nothing}}}, <:Vector{ <: Tuple{<:MultilayerVertex, <:MultilayerVertex}}}
: The list ofMultilayerEdge
s. It may be a vector ofMultilayerEdge
s or a Vector of 2-tuples ofMultilayerVertex
s. In the latter case, the weight and the metadata of theMultilayerEdge
to be added are computed respectively via thedefault_edge_weight
anddefault_edge_metadata
functions;
KWARGS
default_edge_metadata::Function
: Function that takes a pair ofMultilayerVertex
s and returns aTuple
or aNamedTuple
containing the edge metadata, that will be called whenadd_edge!(mg,src,dst, args...; kwargs...)
is called without themetadata
keyword argument, and when generating the edges in this constructor. Defaults to(src, dst) -> NamedTuple()
;transfer_vertex_metadata::Bool
: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;interlayer_name::Symbol
: The name of the Interlayer. Defaults to Symbol("interlayer(layer1.name)(layer2.name)");
interlayer_metadigraph(
layer_1::Layer{T,U},
layer_2::Layer{T,U},
ne::Int64;
default_edge_metadata::Function=(x, y) -> NamedTuple(),
transfer_vertex_metadata::Bool=false,
interlayer_name::Symbol
) where {T<:Integer, U <: Real, G<:AbstractGraph{T}}
Return a random Interlayer with ne
edges whose underlying graph is a MetaDiGraph
from MetaGraphs.jl
, with vertex type T
and weight type U
.
ARGUMENTS
layer_1::Layer{T,U}
: one of the two layers connected by the Interlayer;layer_2::Layer{T,U}
: one of the two layers connected by the Interlayer;ne::Int64
: The number of edges of the Interlayer;
KWARGS
default_edge_metadata::Function
: Function that takes a pair ofMultilayerVertex
s and returns aTuple
or aNamedTuple
containing the edge metadata, that will be called whenadd_edge!(mg,src,dst, args...; kwargs...)
is called without themetadata
keyword argument, and when generating the edges in this constructor. Defaults to(src, dst) -> NamedTuple()
;transfer_vertex_metadata::Bool
: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;interlayer_name::Symbol
: The name of the Interlayer. Defaults to Symbol("interlayer(layer1.name)(layer2.name)");
MultilayerGraphs.interlayer_valoutdigraph
— Functioninterlayer_valoutdigraph(
layer_1::Layer{T,U},
layer_2::Layer{T,U},
edge_list::Union{<:Vector{<:MultilayerEdge{ <: Union{U,Nothing}}}, <:Vector{ <: Tuple{<:MultilayerVertex, <:MultilayerVertex}}};
default_edge_metadata::Function=(x, y) -> NamedTuple()
interlayer_name::Symbol
) where {T<:Integer, U <: Real, G<:AbstractGraph{T}}
Constructor for Interlayer whose underlying graph is a ValOutDiGraph
from SimpleValueGraphs.jl
, with vertex type T
. By default, transfer_vertex_metadata
is set to false
.
ARGUMENTS
layer_1::Layer{T,U}
: one of the two layers connected by the Interlayer;layer_2::Layer{T,U}
: one of the two layers connected by the Interlayer;edge_list::Union{<:Vector{<:MultilayerEdge{ <: Union{U,Nothing}}}, <:Vector{ <: Tuple{<:MultilayerVertex, <:MultilayerVertex}}}
: The list ofMultilayerEdge
s. It may be a vector ofMultilayerEdge
s or a Vector of 2-tuples ofMultilayerVertex
s. In the latter case, the weight and the metadata of theMultilayerEdge
to be added are computed respectively via thedefault_edge_weight
anddefault_edge_metadata
functions;
KWARGS
default_edge_metadata::Function
: Function that takes a pair ofMultilayerVertex
s and returns aTuple
or aNamedTuple
containing the edge metadata, that will be called whenadd_edge!(mg,src,dst, args...; kwargs...)
is called without themetadata
keyword argument, and when generating the edges in this constructor. Defaults to(src, dst) -> NamedTuple()
;interlayer_name::Symbol
: The name of the Interlayer. Defaults to Symbol("interlayer(layer1.name)(layer2.name)");
interlayer_valoutdigraph(
layer_1::Layer{T,U},
layer_2::Layer{T,U},
ne::Int64;
default_edge_metadata::Function=(x, y) -> NamedTuple()
interlayer_name::Symbol
) where {T<:Integer, U <: Real, G<:AbstractGraph{T}}
Return a random Interlayer with ne
edges whose underlying graph is a ValOutDiGraph
from SimpleValueGraphs.jl
, with vertex type T
. By default, transfer_vertex_metadata
is set to false
.
ARGUMENTS
layer_1::Layer{T,U}
: one of the two layers connected by the Interlayer;layer_2::Layer{T,U}
: one of the two layers connected by the Interlayer;ne::Int64
: The number of edges of the Interlayer;
KWARGS
default_edge_metadata::Function
: Function that takes a pair ofMultilayerVertex
s and returns aTuple
or aNamedTuple
containing the edge metadata, that will be called whenadd_edge!(mg,src,dst, args...; kwargs...)
is called without themetadata
keyword argument, and when generating the edges in this constructor. Defaults to(src, dst) -> NamedTuple()
;interlayer_name::Symbol
: The name of the Interlayer. Defaults to Symbol("interlayer(layer1.name)(layer2.name)");
MultilayerGraphs.interlayer_valdigraph
— Functioninterlayer_valdigraph(
layer_1::Layer{T,U},
layer_2::Layer{T,U},
edge_list::Union{<:Vector{<:MultilayerEdge{ <: Union{U,Nothing}}}, <:Vector{ <: Tuple{<:MultilayerVertex, <:MultilayerVertex}}};
default_edge_metadata::Function=(x, y) -> NamedTuple()
interlayer_name::Symbol
) where {T<:Integer, U <: Real, G<:AbstractGraph{T}}
Constructor for Interlayer whose underlying graph is a ValDiGraph
from SimpleValueGraphs.jl
, with vertex type T
. By default, transfer_vertex_metadata
is set to false
.
ARGUMENTS
layer_1::Layer{T,U}
: one of the two layers connected by the Interlayer;layer_2::Layer{T,U}
: one of the two layers connected by the Interlayer;edge_list::Union{<:Vector{<:MultilayerEdge{ <: Union{U,Nothing}}}, <:Vector{ <: Tuple{<:MultilayerVertex, <:MultilayerVertex}}}
: The list ofMultilayerEdge
s. It may be a vector ofMultilayerEdge
s or a Vector of 2-tuples ofMultilayerVertex
s. In the latter case, the weight and the metadata of theMultilayerEdge
to be added are computed respectively via thedefault_edge_weight
anddefault_edge_metadata
functions;
KWARGS
default_edge_metadata::Function
: Function that takes a pair ofMultilayerVertex
s and returns aTuple
or aNamedTuple
containing the edge metadata, that will be called whenadd_edge!(mg,src,dst, args...; kwargs...)
is called without themetadata
keyword argument, and when generating the edges in this constructor. Defaults to(src, dst) -> NamedTuple()
;interlayer_name::Symbol
: The name of the Interlayer. Defaults to Symbol("interlayer(layer1.name)(layer2.name)");
interlayer_valdigraph(
layer_1::Layer{T,U},
layer_2::Layer{T,U},
ne::Int64;
default_edge_metadata::Function=(x, y) -> NamedTuple()
interlayer_name::Symbol
) where {T<:Integer, U <: Real, G<:AbstractGraph{T}}
Return a random Interlayer with ne
edges whose underlying graph is a ValDiGraph
from SimpleValueGraphs.jl
, with vertex type T
. By default, transfer_vertex_metadata
is set to false
.
ARGUMENTS
layer_1::Layer{T,U}
: one of the two layers connected by the Interlayer;layer_2::Layer{T,U}
: one of the two layers connected by the Interlayer;ne::Int64
: The number of edges of the Interlayer;
KWARGS
default_edge_metadata::Function
: Function that takes a pair ofMultilayerVertex
s and returns aTuple
or aNamedTuple
containing the edge metadata, that will be called whenadd_edge!(mg,src,dst, args...; kwargs...)
is called without themetadata
keyword argument, and when generating the edges in this constructor. Defaults to(src, dst) -> NamedTuple()
;interlayer_name::Symbol
: The name of the Interlayer. Defaults to Symbol("interlayer(layer1.name)(layer2.name)");
MultilayerGraphs.multiplex_interlayer
— Methodmultiplex_interlayer(
nv::Int64,
interlayer_name::Symbol,
layer_1::Symbol,
layer_2::Symbol,
graph_type::Type{G};
forbidden_vertices::Vector{MultilayerVertex}, forbidden_edges::Vector{NTuple{2, MultilayerVertex}}
) where {T <: Union{ <: Integer, AbstractVertex}, G <: AbstractGraph{T}}
Return an Interlayer{T,U,G}
that has edges only between vertices that represent the same node.
ARGUMENTS
layer_1::Layer{T,U}
: one of the two layers connected by the Interlayer;layer_2::Layer{T,U}
: one of the two layers connected by the Interlayer;null_graph::G
: the Interlayer's underlying graph type, which must be passed as a null graph. If it is not, an error will be thrown.
KWARGS
default_edge_weight::Function
: Function that takes a pair ofMultilayerVertex
s and returns an edge weight of typeweighttype
ornothing
(which is compatible with unweighted underlying graphs and corresponds toone(weighttype)
for weighted underlying graphs). Defaults to(src, dst) -> nothing
;default_edge_metadata::Function
: Function that takes a pair ofMultilayerVertex
s and returns aTuple
or aNamedTuple
containing the edge metadata, that will be called whenadd_edge!(mg,src,dst, args...; kwargs...)
is called without themetadata
keyword argument, and when generating the edges in this constructor. Defaults to(src, dst) -> NamedTuple()
;interlayer_name::Symbol
: The name of the Interlayer. Defaults to Symbol("interlayer(layer1.name)(layer2.name)");transfer_vertex_metadata::Bool
: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;
MultilayerGraphs.empty_interlayer
— Methodempty_interlayer(
layer_1::Layer{T,U},
layer_2::Layer{T,U},
null_graph::G;
default_edge_weight::Function = (x,y) -> nothing,
default_edge_metadata::Function = (x,y) -> NamedTuple(),
interlayer_name::Symbol),
transfer_vertex_metadata::Bool = false
) where {T<:Integer, U <: Real, G<:AbstractGraph{T}}
Construct an empty interlayer (i.e. an interlayer with no edges).
ARGUMENTS
layer_1::Layer{T,U}
: one of the two layers connected by the Interlayer;layer_2::Layer{T,U}
: one of the two layers connected by the Interlayer;null_graph::G
: the Interlayer's underlying graph type, which must be passed as a null graph. If it is not, an error will be thrown.
KWARGS
default_edge_weight::Function
: Function that takes a pair ofMultilayerVertex
s and returns an edge weight of typeweighttype
ornothing
(which is compatible with unweighted underlying graphs and corresponds toone(weighttype)
for weighted underlying graphs). Defaults to(src, dst) -> nothing
;default_edge_metadata::Function
: Function that takes a pair ofMultilayerVertex
s and returns aTuple
or aNamedTuple
containing the edge metadata, that will be called whenadd_edge!(mg,src,dst, args...; kwargs...)
is called without themetadata
keyword argument, and when generating the edges in this constructor. Defaults to(src, dst) -> NamedTuple()
;interlayer_name::Symbol
: The name of the Interlayer. Defaults to Symbol("interlayer(layer1.name)(layer2.name)");transfer_vertex_metadata::Bool
: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;
MultilayerGraphs.nodes
— Methodnodes(subgraph::AbstractSubGraph)
Return the collection of the nodes of subgraph
.
Graphs.has_vertex
— Methodhas_vertex(layer::Layer, mv::MultilayerVertex)
Return true
if v
is a vertex of layer
.
Graphs.has_vertex
— Methodhas_vertex(interlayer::Interlayer, v::MultilayerVertex)
Return true
if v
is a vertex of interlayer
.
Graphs.nv
— Methodnv(subgraph::AbstractSubGraph)
Return the number of vertices in subgraph
.
MultilayerGraphs.mv_vertices
— Methodmv_vertices(subgraph::AbstractSubGraph)
Return the collection of the MultilayerVertex
s of subgraph
.
MultilayerGraphs.mv_inneighbors
— Methodmv_inneighbors(subgraph::AbstractSubGraph, mv::MultilayerVertex)
Return the MultilayerVertex
s inneighbors of mv
within subgraph
.
MultilayerGraphs.mv_outneighbors
— Methodmv_outneighbors(subgraph::AbstractSubGraph, mv::MultilayerVertex)
Return the MultilayerVertex
s outneighbors of mv
within subgraph
.
MultilayerGraphs.mv_neighbors
— Methodmv_neighbors(subgraph::AbstractSubGraph, mv::MultilayerVertex)
Defaults to mv_outneighbors
.
Graphs.has_edge
— Methodhas_edge(subgraph::AbstractSubGraph,me::MultilayerEdge)
Return true
if there is an edge from src(me)
to dst(me)
within subgraph, false
otherwise.
Graphs.has_edge
— Methodhas_edge( subgraph::AbstractSubGraph, s::MultilayerVertex, d::MultilayerVertex)
Return true
if there is an edge between s
and d
, false
otherwise.
Graphs.has_edge
— Methodhas_edge( layer::Layer, s::MultilayerVertex{nothing}, d::MultilayerVertex{nothing})
Return true
if there is an edge between s
and d
, false
otherwise.
Graphs.ne
— Methodne(subgraph::AbstractSubGraph)
Return the number of edges in subgraph
.
Graphs.edges
— Methodedges(subgraph::S) where {T,U,S<:AbstractSubGraph{T,U}}
Return an iterator over all the edges of subgraph
.
Graphs.SimpleGraphs.add_edge!
— Methodadd_edge!( subgraph::S, me::E) where {T,U<:Real,S<:AbstractSubGraph{T,U},E<:MultilayerEdge{ <: Union{U, Nothing}}}
Add unweighted edge me
to subgraph
. Its weight
and metadata
fields are passed to the uniform interface of add_edge!(::Layer, ::MultilayerVertex, ::MultilayerVertex, ::Tuple)
.
Graphs.SimpleGraphs.add_edge!
— Methodadd_edge!(layer::L, src::MultilayerVertex, dst::MultilayerVertex, args...; kwargs...) where {L <: Layer}
Add edge from vertex src
to vertex dst
to layer layer
. Returns true if succeeds. This method supports the uniform and transparent interfaces. See the Edges section of the Tutorial.
Graphs.SimpleGraphs.add_edge!
— Methodadd_edge!(interlayer::Interlayer, src::MultilayerVertex, dst::MultilayerVertex, args...; kwargs...)
Add edge from vertex src
to vertex dst
to Interlayer interlayer
.Returns true if succeeds, but will fail (return false) if src
and dst
belong to the same layer, since interlayers are always bipartite. This method supports the uniform and transparent interfaces. See the Edges section of the Tutorial.
Graphs.SimpleGraphs.rem_edge!
— Methodrem_edge!(subgraph::AbstractSubGraph, src::MultilayerVertex, dst::MultilayerVertex)
Remove edge from src
to dst
in subgraph
.
Graphs.SimpleGraphs.rem_edge!
— Methodrem_edge!(subgraph::AbstractSubGraph, me::MultilayerEdge)
Remove edge from src(me)
to dst(me)
in subgraph
.
MultilayerGraphs.get_metadata
— Methodget_metadata(subgraph::AbstractSubGraph, bare_mv::MultilayerVertex)
Return the metadata of the vertex bare_mv
in subgraph
(metadata assigned to bare_mv
will be discarded).
MultilayerGraphs.get_metadata
— Methodget_edge_metadata(subgraph::S, src::MultilayerVertex, dst::MultilayerVertex)
Return the metadata of the edge between the source vertex src
and the destination vertex dst
in subgraph
.
SimpleWeightedGraphs.get_weight
— Methodget_weight(subgraph::S, src::MultilayerVertex, dst::MultilayerVertex)
Return the weight of the edge between the source vertex src
and the destination vertex dst
in subgraph
.
Graphs.is_directed
— Methodis_directed(subgraph::AbstractSubGraph)
Return true
if subgraph
is directed, false
otherwise.
Graphs.is_directed
— Methodis_directed(::Type{S}) where {T,U,G,S <: AbstractSubGraph{T,U,G}}
Return true
if instances of S
are directed, false
otherwise.
Graphs.LinAlg.adjacency_matrix
— Methodadjacency_matrix(subgraph::AbstractSubGraph)
Return the adjacency matrix of subgraph.graph
.
Graphs.weights
— Methodweights(subgraph::S) where { T,U, G <: AbstractGraph{T}, S <:AbstractSubGraph{T,U,G}}
Return the weights of subgraph.graph
, with the eltype converted to U
.
MultilayerGraphs.is_multiplex_interlayer
— Methodis_multiplex_interlayer(interlayer::In) where {In <: Interlayer}
Check that Interlayer interlayer
is a multiplex-type Interlayer.
MultilayerGraphs.get_symmetric_interlayer
— Methodget_symmetric_interlayer(interlayer::In; symmetric_interlayer_name::String) where{T,U,G, In <: Interlayer{T,U,G}}
Return the Interlayer
corresponding to interlayer
where layer_1
and layer_2
are swapped. Its interlayername will be `symmetricinterlayername(defaults to
interlayer(interlayer.layer2)(interlayer.layer_1)`).
MultilayerGraphs.name
— Methodname(subgraph::AbstractSubGraph)
Return the name of subgraph
.
MultilayerGraphs.graph
— Methodname(subgraph::AbstractSubGraph)
Return the underlying graph of subgraph
.
Multilayer-Specific Methods
MultilayerGraphs.AbstractMultilayerGraph
— TypeAbstractMultilayerGraph{T <: Integer, U <: Real} <: AbstractGraph{T}
An abstract type for multilayer graphs. It is a subtype of AbstractGraph and its concrete subtypes may extend Graphs.jl.
Its concrete subtypes must have the following fields:
idx_N_associations::Bijection{Int64,Node}
:;v_V_associations::Bijection{T,<:MultilayerVertex}
:;v_metadata_dict::Dict{T,<:Union{<:Tuple,<:NamedTuple}}
:;layers
: an indexable collection ofLayer
s.interlayers
:a collection ofInterlayer
s;layers_names
: a collection of the names of the layers.subgraphs_names
: a collection of the names of all the subgraphs.fadjlist::Vector{Vector{HalfEdge{<:MultilayerVertex,<:Union{Nothing,U}}}}
: the forward adjacency list.
MultilayerGraphs.has_node
— Methodhas_node(mg::AbstractMultilayerGraph, n::Node)
Return true if n
is a node of mg
.
MultilayerGraphs.nodes
— Methodnodes(mg::AbstractMultilayerGraph
Return the nodes of the AbstractMultilayerGraph mg
, in order of addition.
MultilayerGraphs.nn
— Methodnn(mg::M) where {M <: AbstractMultilayerGraph }
Return the number of nodes in mg
.
Graphs.has_vertex
— Methodhas_vertex(mg::AbstractMultilayerGraph, mv::MultilayerVertex)
Return true if mv
is in mg
, else false.
Graphs.nv
— Methodnv(mg::M) where {M <: AbstractMultilayerGraph }
Return the number of vertices in mg
, excluding the missing vertices.
MultilayerGraphs.mv_vertices
— Methodmv_vertices(mg::AbstractMultilayerGraph)
Return a list of the MultilayerVertex
s contained in mg
.
MultilayerGraphs.get_metadata
— Methodget_metadata(mg::AbstractMultilayerGraph, bare_mv::MultilayerVertex)
Return the metadata associated to MultilayerVertex
mv (regardless of metadata assigned to bare_mv
).
MultilayerGraphs.set_metadata!
— Methodset_metadata!(mg::AbstractMultilayerGraph, mv::MultilayerVertex, metadata::Union{Tuple, NamedTuple})
Set the metadata of vertex mv
to metadata
. Return true if succeeds
MultilayerGraphs.mv_inneighbors
— Methodmv_inneighbors(mg::AbstractMultilayerGraph, mv::MultilayerVertex)
Return the list of MultilayerVertex
inneighbors of mv
within mg
.
MultilayerGraphs.mv_outneighbors
— Methodmv_outneighbors(mg::AbstractMultilayerGraph, mv::MultilayerVertex)
Return the list of MultilayerVertex
outneighbors of mv
within mg
.
MultilayerGraphs.mv_neighbors
— Methodmv_neighbors(mg::AbstractMultilayerGraph, mv::MultilayerVertex)
Return the list of MultilayerVertex
neighbors of mv
within mg
.
Graphs.has_edge
— Methodhas_edge(mg::AbstractMultilayerGraph, edge::MultilayerEdge)
Return true if mg
has an edge between the source and the destination of edge
(does not check edge or vertex metadata).
Graphs.has_edge
— Methodhas_edge(mg::AbstractMultilayerGraph, src::MultilayerVertex, dst::MultilayerVertex)
Return true if mg
has edge between the src
and dst
(does not check edge or vertex metadata).
Graphs.ne
— Methodne(mg::AbstractMultilayerGraph)
Return the number of edges in mg
.
Graphs.edges
— Methodedges(mg::M) where {T,U,M<:AbstractMultilayerGraph{T,U}; IsDirected{M}}
Return an list of all the edges of mg
.
Graphs.edges
— Methodedges(mg::M) where {T,U,M<:AbstractMultilayerGraph{T,U}; !IsDirected{M}}
Return an list of all the edges of mg
.
Graphs.SimpleGraphs.add_edge!
— Methodadd_edge!(mg::M, src::V, dst::V; weight::Union{Nothing, U} = one(U), metadata::Union{Tuple,NamedTuple} = NamedTuple() ) where {T,U, M <: AbstractMultilayerGraph{T,U}, V <: MultilayerVertex}
Add a MultilayerEdge between src
and dst
with weight weight
and metadata metadata
. Return true if succeeds, false otherwise.
Graphs.SimpleGraphs.rem_edge!
— Methodrem_edge!(mg::AbstractMultilayerGraph, me::MultilayerEdge)
Remove edge from src(me)
to dst(me)
from mg
. Return true if succeeds, false otherwise.
MultilayerGraphs.get_metadata
— Methodget_metadata(mg::AbstractMultilayerGraph, src::MultilayerVertex, dst::MultilayerVertex)
Return the metadata associated to the MultilayerEdge
from src
to dst
.
SimpleWeightedGraphs.get_weight
— Methodget_weight(mg::AbstractMultilayerGraph, src::MultilayerVertex, dst::MultilayerVertex)h
Return the weight associated to the MultilayerEdge
from src
to dst
.
MultilayerGraphs.set_weight!
— Methodset_weight!(mg::M, src::MultilayerVertex{L1}, dst::MultilayerVertex{L2}, weight::U) where {L1 <: Symbol, L2 <: Symbol, T,U, M <: AbstractMultilayerGraph{T,U}}
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).
MultilayerGraphs.set_weight!
— Methodset_weight!(
mg::M, src::MultilayerVertex, dst::MultilayerVertex, weight::U
) where {T,U,M<:AbstractMultilayerGraph{T,U}; IsDirected{M}}
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).
MultilayerGraphs.set_metadata!
— Methodset_metadata!(mg::AbstractMultilayerUGraph, src::MultilayerVertex, dst::MultilayerVertex, metadata::Union{Tuple, NamedTuple})
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).
MultilayerGraphs.set_metadata!
— Methodset_metadata!(
mg::M,
src::MultilayerVertex,
dst::MultilayerVertex,
metadata::Union{Tuple,NamedTuple},
) where {M<:AbstractMultilayerGraph; IsDirected{M}}
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).
MultilayerGraphs.nl
— Methodnl(mg::AbstractMultilayerGraph)
Return the number of layers in mg
.
MultilayerGraphs.nIn
— MethodnIn(mg::AbstractMultilayerGraph)
Return the number of interlayers in mg
.
MultilayerGraphs.has_layer
— Methodhas_layer(mg::AbstractMultilayerGraph, layer_name::Symbol)
Return true in layer_name
is a name of a [Layer](@ref)
of mg
.
MultilayerGraphs.add_layer!
— Methodadd_layer!(
mg::M,
new_layer::L;
default_interlayers_null_graph::H=SimpleGraph{T}(),
default_interlayers_structure::String="multiplex",
) where {
T,
U,
G<:AbstractGraph{T},
L<:Layer{T,U,G},
H<:AbstractGraph{T},
M<:MultilayerGraph{T,U}
}
Add layer layer
to mg
.
ARGUMENTS
mg::M
: theMultilayerGraph
which the new layer will be added to;new_layer::L
: the newLayer
to add tomg
;default_interlayers_null_graph::H = SimpleGraph{T}()
: upon addition of a newLayer
, all theInterlayer
s between the new and the existingLayer
s are immediately created. This keyword argument specifies theirnull_graph
See theLayer
constructor for more information. Defaults toSimpleGraph{T}()
;default_interlayers_structure::String = "multiplex"
: The structure of theInterlayer
s created by default. May either be "multiplex" to have diagonally-coupled only interlayers, or "empty" for empty interlayers. Defaults to "multiplex".
MultilayerGraphs.add_layer!
— Methodadd_layer!(
mg::M,
new_layer::L;
default_interlayers_null_graph::H=SimpleGraph{T}(),
default_interlayers_structure::String="multiplex",
) where {
T,
U,
G<:AbstractGraph{T},
L<:Layer{T,U,G},
H<:AbstractGraph{T},
M<:MultilayerDiGraph{T,U}
}
Add layer layer
to mg
.
ARGUMENTS
mg::M
: theMultilayerDiGraph
which the new layer will be added to;new_layer::L
: the newLayer
to add tomg
;default_interlayers_null_graph::H
: upon addition of a newLayer
, all theInterlayer
s between the new and the existingLayer
s are immediately created. This keyword argument specifies theirnull_graph
See theLayer
constructor for more information. Defaults toSimpleGraph{T}()
;default_interlayers_structure::String
: The structure of theInterlayer
s created by default. May either be "multiplex" to have diagonally-coupled only interlayers, or "empty" for empty interlayers. Defaults to "multiplex".
MultilayerGraphs.specify_interlayer!
— Methodspecify_interlayer!(
mg::M,
new_interlayer::In
) where {T,U,G<:AbstractGraph{T},In<:Interlayer{T,U,G}, M<:MultilayerGraph{T,U}; !IsDirected{M}}
Specify the interlayer new_interlayer
as part of mg
.
MultilayerGraphs.specify_interlayer!
— Methodspecify_interlayer!(
mg::M,
new_interlayer::In
) where {T,U,G<:AbstractGraph{T},M<:MultilayerDiGraph{T,U},In<:Interlayer{T,U,G}}
Specify the interlayer new_interlayer
as part of mg
.
MultilayerGraphs.get_interlayer
— Methodget_interlayer(
mg::AbstractMultilayerGraph, layer_1_name::Symbol,
layer_2_name::Symbol
)
Return the Interlayer
between layer_1
and layer_2
.
Graphs.indegree
— Methodindegree( mg::AbstractMultilayerGraph, v::MultilayerVertex)
Get the indegree of vertex v
in mg
.
Graphs.indegree
— Functionindegree( mg::M, vs::AbstractVector{V}=vertices(mg)) where {T,M<:AbstractMultilayerGraph{T,<:Real},V<:MultilayerVertex}
Get the vector of indegrees of vertices vs
in mg
.
Graphs.outdegree
— Methodoutdegree(mg::AbstractMultilayerGraph, mv::MultilayerVertex)
Get the outdegree of vertex v
in mg
.
Graphs.outdegree
— Functionoutdegree(mg::M, vs::AbstractVector{V}=vertices(mg)) where {T,M<:AbstractMultilayerGraph{T,<:Real},V<:MultilayerVertex}
Get the vector of outdegrees of vertices vs
in mg
.
Graphs.degree
— Methoddegree(mg::AbstractMultilayerGraph, vs::AbstractVector{<:MultilayerVertex}=vertices(mg))
Get the degree of vertices vs
in mg
.
Graphs.degree
— Methoddegree(
mg::M, mv::V
) where {M<:AbstractMultilayerGraph, V<:MultilayerVertex; IsDirected{M}}
Return the degree of MultilayerVertex v
within mg
.
Graphs.degree
— Methoddegree(mg::M, v::V) where {T,M<:AbstractMultilayerUGraph{T,<:Real},V<:MultilayerVertex}
Return the degree of MultilayerVertex v
within mg
.
MultilayerGraphs.mean_degree
— Methodmean_degree(mg::AbstractMultilayerGraph)
Return the mean of the degree sequence of mg
.
MultilayerGraphs.degree_second_moment
— Methoddegree_second_moment(mg::AbstractMultilayerGraph)
Calculate the second moment of the degree sequence of mg
.
MultilayerGraphs.degree_variance
— Methoddegree_variance(mg::AbstractMultilayerGraph)
Return the variance of the degree sequence of mg
.
MultilayerGraphs.weighttype
— Methodweighttype(::M) where {T,U,M<:AbstractMultilayerGraph{T,U}}
Return the weight type of mg
(i.e. the eltype of the weight tensor or the supra-adjacency matrix).
MultilayerGraphs.multilayer_global_clustering_coefficient
— Functionmultilayer_global_clustering_coefficient(
mg::AbstractMultilayerGraph,
norm_factor::Union{Float64,Symbol}=:max
)
Return the complete multilayer global clustering coefficient, equal to the ratio of realized triplets over all possible triplets, including those whose every or some edges belong to interlayers, normalized by norm_factor
. If norm_factor == :max
, then the ratio is normalized by maximum(array(weight_tensor(mg)))
, else it is not normalized. This function does not override Graphs.jl's global_clustering_coefficient
, since the latter does not consider cliques where two nodes are the same node but in different layers/interlayers. See De Domenico et al. (2013).
MultilayerGraphs.overlay_clustering_coefficient
— Functionoverlay_clustering_coefficient(
mg::AbstractMultilayerGraph,
norm_factor::Union{Float64,Symbol}=:max
)
Return the overlay clustering coefficient as calculated in De Domenico et al. (2013). If norm_factor == :max
, then the ratio is normalized by maximum(array(weight_tensor(mg)))
, else it is not normalized.
Graphs.eigenvector_centrality
— Methodeigenvector_centrality(
mg::M;
norm::String = "1",
tol::Float64 = 1e-6,
maxiter::Int64 = 2000
) where {T, U, M <: AbstractMultilayerGraph{T, U}}
Calculate the eigenvector centrality of mg
via an iterative algorithm. The norm
parameter may be "1"
or "n"
, and respectively the eigenvector centrality will be normalized to 1 or further divided by the number of nodes of mg
. The tol
parameter terminates the approximation when two consecutive iteration differ by no more than tol
. The maxiters
parameter terminates the algorithm when it goes beyond maxiters
iterations.
The returned values are: the eigenvector centrality and the relative error at each algorithm iteration, that is, the summed absolute values of the componentwise differences between the centrality computed at the current iteration minus the centrality computed at the previous iteration.
Note: in the limit case of a monoplex graph, this function outputs a eigenvector centrality vector that coincides the one outputted by Graphs.jl's eigenvector_centrality
.
Graphs.modularity
— Methodmodularity(
mg::M,
c::Matrix{Int64};
null_model::Union{String,Array{U,4}} = "degree"
) where {T, U, M <: AbstractMultilayerGraph{T,U}}
Calculate the modularity of mg
, as shown in De Domenico et al. (2013).
MultilayerGraphs.von_neumann_entropy
— Methodvon_neumann_entropy(mg::M) where {T,U, M <: AbstractMultilayerUGraph{T, U}}
Compute the Von Neumann entropy of mg
, according to De Domenico et al. (2013). Only for undirected multilayer graphs.
Concrete Multilayer Graphs
(General) Multilayer Graphs
MultilayerGraph
MultilayerGraphs.MultilayerGraph
— TypeMultilayerGraph{T, U, G <: AbstractGraph{T}} <: AbstractMultilayerGraph{T,U}
A concrete type that can represent a general multilayer graph. Its internal fields aren't meant to be modified by the user. Please prefer the provided API.
MultilayerGraphs.MultilayerGraph
— MethodMultilayerGraph(T::Type{<:Number}, U::Type{<:Number})
Return a null MultilayerGraph with with vertex type T
weighttype U
. Use this constructor and then add Layers and Interlayers via the add_layer!
and specify_interlayer!
methods.
MultilayerGraphs.MultilayerGraph
— MethodMultilayerGraph(
layers::Vector{<:Layer{T,U}},
specified_interlayers::Vector{<:Interlayer{T,U}};
default_interlayers_null_graph::H = SimpleGraph{T}(),
default_interlayers_structure::String="multiplex",
) where {T,U, H <: AbstractGraph{T}}
Construct a MultilayerGraph with layers given by layers
. The interlayers will be constructed by default according to default_interlayer
where only "multiplex"
and "empty"
are allowed, except for those specified in specified_interlayers
. default_interlayer = "multiplex"
will imply that unspecified interlayers will have only diagonal couplings, while default_interlayer = "multiplex"
will produced interlayers that have no couplings.
ARGUMENTS
layers::Vector{<:Layer{T,U}}
: The (ordered) list of layers the multilayer graph will have;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 thedefault_interlayers_null_graph
anddefault_interlayers_structure
keywords;default_interlayers_null_graph::H = SimpleGraph{T}()
: Sets the underlying graph for the interlayers that are to be automatically specified. Defaults toSimpleGraph{T}()
. See theInterlayer
constructors for more information;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 theInterlayer
constructors for more information.
MultilayerGraphs.MultilayerGraph
— MethodMultilayerGraph(
empty_layers::Vector{<:Layer{T,U}},
empty_interlayers::Vector{<:Interlayer{T,U}},
degree_distribution::UnivariateDistribution;
allow_self_loops::Bool = false,
default_interlayers_null_graph::H = SimpleGraph{T}(),
) where {T <: Integer, U <: Real, H <: AbstractGraph{T}}
Return a random MultilayerGraph that has empty_layers
as layers and empty_interlayers
as specified interlayers. empty_layers
and empty_interlayers
must respectively be Layer
s and Interlayer
s with whatever number of vertices but no edges (if any edge is found, an error is thrown). The degree distribution of the returned random MultilayerGraph
is given by degree_distribution
, which must have a support that only contains positive numbers for obvious reasons. allow_self_loops = true
allows for self loops t be present in the final random MultilayerGraph. default_interlayers_null_graph
controls the null_graph
argument passed to automatically-generated interlayers.
MultilayerGraphs.MultilayerGraph
— MethodMultilayerGraph(empty_multilayergraph::MultilayerGraph{T,U},
degree_sequence::Vector{<:Integer};
allow_self_loops::Bool = false,
perform_checks::Bool = false) where {T,U}
Return a random MultilayerGraph
with degree sequence degree_sequence
. allow_self_loops
controls the presence of self-loops, while if perform_checks
is true, the degree_sequence
os checked to be graphical.
MultilayerGraphs.add_node!
— Methodadd_node!(mg::MultilayerGraph, n::Node; add_vertex_to_layers::Union{Vector{Symbol}, Symbol} = Symbol[])
Add node n
to mg
. Return true if succeeds. Additionally, add a corresponding vertex to all layers whose name is listed in add_vertex_to_layers
. If add_vertex_to_layers == :all
, then a corresponding vertex is added to all layers.
MultilayerGraphs.rem_node!
— Methodrem_node!(mg::MultilayerGraph, n::Node)
Remove node n
to mg
. Return true if succeeds.
Graphs.SimpleGraphs.add_vertex!
— Methodadd_vertex!(mg::MultilayerGraph, mv::MultilayerVertex; add_node::Bool = true)
Add MultilayerVertex mv
to multilayer graph mg
. If add_node
is true and node(mv)
is not already part of mg
, then add node(mv)
to mg
before adding mv
to mg
instead of throwing an error.
Graphs.SimpleGraphs.rem_vertex!
— Methodrem_vertex!(mg::MultilayerGraph, V::MultilayerVertex)
Remove MultilayerVertex mv
from mg
. Return true if succeeds, false otherwise.
Graphs.SimpleGraphs.add_edge!
— Methodadd_edge!(mg::M, me::E) where {T,U, M <: MultilayerGraph{T,U}, E <: MultilayerEdge{ <: Union{U,Nothing}}}
Add a MultilayerEdge between src
and dst
with weight weight
and metadata metadata
. Return true if succeeds, false otherwise.
Graphs.SimpleGraphs.rem_edge!
— Methodrem_edge!(mg::MultilayerGraph, me::MultilayerEdge)
Remove edge from src(me)
to dst(me)
from mg
. Return true if succeeds, false otherwise.
Graphs.is_directed
— Methodis_directed(m::M) where { M <: Type{ <: MultilayerGraph}}
Return false
MultilayerDiGraph
MultilayerGraphs.MultilayerDiGraph
— TypeMultilayerDiGraph{T, U, G <: AbstractGraph{T}} <: AbstractMultilayerGraph{T,U}
A concrete type that can represent a general multilayer graph. Its internal fields aren't meant to be modified by the user. Please prefer the provided API.
MultilayerGraphs.MultilayerDiGraph
— MethodMultilayerDiGraph(n_nodes::Int64, T::Type{ <: Number}, U::Type{ <: Number} )
Return a null MultilayerDiGraph with with vertex type T
weighttype U
. Use this constructor and then add Layers and Interlayers via the add_layer!
and specify_interlayer!
methods.
MultilayerGraphs.MultilayerDiGraph
— MethodMultilayerDiGraph(
layers::Vector{<:Layer{T,U}},
specified_interlayers::Vector{<:Interlayer{T,U}};
default_interlayers_null_graph::H = SimpleGraph{T}(),
default_interlayers_structure::String="multiplex",
) where {T,U, H <: AbstractGraph{T}}
Construct a MultilayerDiGraph with layers given by layers
. The interlayers will be constructed by default according to default_interlayer
where only "multiplex"
and "empty"
are allowed, except for those specified in specified_interlayers
. default_interlayer = "multiplex"
will imply that unspecified interlayers will have only diagonal couplings, while default_interlayer = "multiplex"
will produced interlayers that have no couplings.
MultilayerGraphs.MultilayerDiGraph
— MethodMultilayerDiGraph(
empty_layers::Vector{<:Layer{T,U}},
empty_interlayers::Vector{<:Interlayer{T,U}},
indegree_distribution::UnivariateDistribution,
outdegree_distribution::UnivariateDistribution;
allow_self_loops::Bool = false,
default_interlayers_null_graph::H = SimpleGraph{T}(),
) where {T <: Integer, U <: Real, H <: AbstractGraph{T}}
Return a random MultilayerDiGraph that has empty_layers
as layers and empty_interlayers
as specified interlayers. empty_layers
and empty_interlayers
must respectively be Layer
s and Interlayer
s with whatever number of vertices but no edges (if any edge is found, an error is thrown). The degree distribution of the returned random MultilayerDiGraph
is given by degree_distribution
, which must have a support that only contains positive numbers for obvious reasons. allow_self_loops = true
allows for self loops t be present in the final random MultilayerDiGraph. default_interlayers_null_graph
controls the null_graph
argument passed to automatically-generated interlayers.
MultilayerGraphs.MultilayerDiGraph
— MethodMultilayerDiGraph(
empty_multilayerdigraph::MultilayerDiGraph{T,U},
indegree_sequence::Vector{<:Integer},
outdegree_sequence::Vector{<:Integer};
allow_self_loops::Bool = false,
perform_checks::Bool = false
) where {T,U}
Return a random MultilayerDiGraph
with degree sequence degree_sequence
. allow_self_loops
controls the presence of self-loops, while if perform_checks
is true, the degree_sequence
os checked to be graphical.
MultilayerGraphs.add_node!
— Methodadd_node!(mg::MultilayerDiGraph, n::Node; add_vertex_to_layers::Union{Vector{Symbol}, Symbol} = Symbol[])
Add node n
to mg
. Return true if succeeds. Additionally, add a corresponding vertex to all layers whose name is listed in add_vertex_to_layers
. If add_vertex_to_layers == :all
, then a corresponding vertex is added to all layers.
MultilayerGraphs.rem_node!
— Methodrem_node!(mg::MultilayerDiGraph, n::Node)
Remove node n
to mg
. Return true if succeeds.
Graphs.SimpleGraphs.add_vertex!
— Methodadd_vertex!(mg::MultilayerDiGraph, mv::MultilayerVertex; add_node::Bool = true)
Add MultilayerVertex mv
to multilayer graph mg
. If add_node
is true and node(mv)
is not already part of mg
, then add node(mv)
to mg
before adding mv
to mg
instead of throwing an error.
Graphs.SimpleGraphs.rem_vertex!
— Methodrem_vertex!(mg::MultilayerDiGraph, V::MultilayerVertex)
Remove MultilayerVertex mv
from mg
. Return true if succeeds, false otherwise.
Graphs.SimpleGraphs.add_edge!
— Methodadd_edge!(mg::M, me::E) where {T,U, M <: MultilayerDiGraph{T,U}, E <: MultilayerEdge{ <: Union{U,Nothing}}}
Add a MultilayerEdge between src
and dst
with weight weight
and metadata metadata
. Return true if succeeds, false otherwise.
Graphs.SimpleGraphs.rem_edge!
— Methodrem_edge!(mg::MultilayerDiGraph, me::MultilayerEdge)
Remove edge from src(me)
to dst(me)
from mg
. Return true if succeeds, false otherwise.
Graphs.is_directed
— Methodis_directed(m::M) where { M <: Type{ <: MultilayerDiGraph}}
Return false
Node Aligned Edge Colored Graphs
MultilayerGraphs.AbstractNodeAlignedEdgeColoredGraph
— TypeAbstractNodeAlignedEdgeColoredGraph{T,U} <: AbstractMultilayerGraph{T,U}
An abstract type representing an edge-colored and synchronized (i.e. every node is represented in each layer) graph. As such:
add_node!
will always add the corresponding vertex in all layers;add_vertex!
andrem_vertex!
are not available for this type;- All Interlayers automatically added by
add_layer!
are empty simple graphs. specify_interlayer!
is not available.
MultilayerGraphs.add_node!
— Methodadd_node!(mg::AbstractNodeAlignedEdgeColoredGraph, n::Node; add_vertex_to_layers::Union{Vector{Symbol}, Symbol} = Symbol[])
Add node n
to mg
. Return true if succeeds. Additionally, add a corresponding vertex to all layers.
MultilayerGraphs.rem_node!
— Methodrem_node!(mg::AbstractNodeAlignedEdgeColoredGraph, n::Node)
Remove node n
to mg
. Return true if succeeds.
Graphs.SimpleGraphs.add_edge!
— Methodadd_edge!(mg::M, me::E) where {T,U, M <: AbstractNodeAlignedEdgeColoredGraph{T,U}, E <: MultilayerEdge{ <: Union{U,Nothing}}}
Add a MultilayerEdge between src
and dst
with weight weight
and metadata metadata
. Return true if succeeds, false otherwise.
Graphs.SimpleGraphs.rem_edge!
— Methodrem_edge!(mg::AbstractNodeAlignedEdgeColoredGraph, me::MultilayerEdge)
Remove edge from src(me)
to dst(me)
from mg
. Return true if succeeds, false otherwise.
MultilayerGraphs.add_layer!
— Methodadd_layer!( mg::M,
new_layer::L;
) where {T,U,G<:AbstractGraph{T},L<:Layer{T,U,G}, H <: AbstractGraph{T}, M<:AbstractNodeAlignedEdgeColoredGraph{T,U}; !IsDirected{M}}
Add layer layer
to the synchronized edge-colored graph mg
.
ARGUMENTS
mg::M
: theAbstractNodeAlignedEdgeColoredGraph
which the new layer will be added to;new_layer::L
: the newLayer
to add tomg
;
NodeAlignedEdgeColoredGraph
MultilayerGraphs.NodeAlignedEdgeColoredGraph
— TypeNodeAlignedEdgeColoredGraph{T, U, G <: AbstractGraph{T}} <: AbstractMultilayerGraph{T,U}
A concrete type that can represent a general edge colored graph, that is synchronized i.e. that it represents every node in each layer. Thus:
add_node!
will always add the corresponding vertex in all layers;add_vertex!
andrem_vertex!
are not available for this type;- All Interlayers automatically added by
add_layer!
are empty simple graphs. specify_interlayer!
is not available.
Its internal fields aren't meant to be modified by the user. Please prefer the provided API.
MultilayerGraphs.NodeAlignedEdgeColoredGraph
— MethodNodeAlignedEdgeColoredGraph(
layers::Vector{<:Layer{T,U}}
) where {T,U, H <: AbstractGraph{T}}
Construct a NodeAlignedEdgeColoredGraph with layers given by layers
. The interlayers will be constructed by default as empty.
ARGUMENTS
layers::Vector{<:Layer{T,U}}
: The (ordered) list of layers the multilayer graph will have;
Graphs.is_directed
— Methodis_directed(m::M) where { M <: Type{ <: NodeAlignedEdgeColoredGraph}}
Return false
NodeAlignedEdgeColoredDiGraph
MultilayerGraphs.NodeAlignedEdgeColoredDiGraph
— TypeNodeAlignedEdgeColoredDiGraph{T, U, G <: AbstractGraph{T}} <: AbstractMultilayerGraph{T,U}
A concrete type that can represent a general directed edge colored graph, that is synchronized i.e. that it represents every node in each layer. Thus:
add_node!
will always add the corresponding vertex in all layers;add_vertex!
andrem_vertex!
are not available for this type;- All Interlayers automatically added by
add_layer!
are empty simple graphs. specify_interlayer!
is not available.
Its internal fields aren't meant to be modified by the user. Please prefer the provided API.
MultilayerGraphs.NodeAlignedEdgeColoredDiGraph
— MethodNodeAlignedEdgeColoredDiGraph(
layers::Vector{<:Layer{T,U}}
) where {T,U, H <: AbstractGraph{T}}
Construct a NodeAlignedEdgeColoredDiGraph with layers given by layers
. The interlayers will be constructed by default as empty.
ARGUMENTS
layers::Vector{<:Layer{T,U}}
: The (ordered) list of layers the multilayer graph will have;
Graphs.is_directed
— Methodis_directed(m::M) where { M <: Type{ <: NodeAlignedEdgeColoredDiGraph}}
Return false
Representations
MultilayerGraphs.array
— Methodarray(atr::AbstractTensorRepresentation)
Return the array representation of atr
.
MultilayerGraphs.WeightTensor
— TypeWeightTensor{U}
Concrete type representing the weight tensor of a multilayer graph. Look at the EXAMPLES section below to learn how to use it.
EXAMPLES
# Assuming a MultilayerGraph named mg is defined, and that mv1 and mv2 are two of its `MultilayerVertex`ss
wt = WeightTensor(mg)
# One may access te corresponding WeightTensor's entry via:
wt[mv1, mv2]
MultilayerGraphs.weight_tensor
— Methodweight_tensor(mg::M) where {T,U, M <: AbstractMultilayerGraph{T,U}}
Compute the weight tensor of mg
. Return an object of type WeightTensor
.
MultilayerGraphs.MetadataTensor
— TypeMetadataTensor{U}
Concrete type representing the metadata tensor of a multilayer graph. Look at the EXAMPLES section below to learn how to use it.
EXAMPLES
# Assuming a MultilayerGraph named mg is defined, and that mv1 and mv2 are two of its `MultilayerVertex`s
mt = MetadataTensor(mg)
# One may access te corresponding MetadataTensor's entry via:
mt[mv1, mv2]
MultilayerGraphs.metadata_tensor
— Methodmetadata_tensor(mg::M) where {T,U, M <: AbstractMultilayerGraph{T,U}}
Compute the weight tensor of mg
. Return an object of type WeightTensor
.
MultilayerGraphs.array
— Methodarray(amr::AbstractMatrixRepresentation)
Return the array representation of amr
.
MultilayerGraphs.SupraWeightMatrix
— TypeSupraWeightMatrix{T,U}
A concrete type representing the (supra) weight matrix of a multilayer graph. It takes into account missing vertices by default. Look at the EXAMPLES section to learn how to use it.
EXAMPLES
# Assuming a MultilayerGraph named mg is defined, and that mv1 and mv2 are two of its `MultilayerVertex`ss
swm = SupraWeightMatrix(mg)
# One may access te corresponding SupraWeightMatrix's entry via:
swm[mv1, mv2]
MultilayerGraphs.supra_weight_matrix
— Methodsupra_weight_matrix(mg::M) where {T,U, M <: AbstractMultilayerGraph{T,U}}
Compute the supra weight matrix of mg
. Return an object of type SupraWeightMatrix
Traits
MultilayerGraphs.is_weighted
— Methodis_weighted(g::G) where { G <: AbstractGraph}
Check whether g
is weighted.
MultilayerGraphs.is_weighted
— Methodis_weighted(g::G) where {G<:Type{<:AbstractGraph}}
Check whether g
is weighted.
MultilayerGraphs.is_meta
— Methodis_meta(g::G) where {G <: AbstractGraph}
Check whether g
supports edge AND vertex metadata.
MultilayerGraphs.is_meta
— Methodis_meta(g::G) where {G<:Type{<:AbstractGraph}}
Check whether g
supports edge AND vertex metadata.
Utilities
MultilayerGraphs.multilayer_kronecker_delta
— Methodmultilayer_kronecker_delta(dims::NTuple{4,Int64})
Return a 4-dimensional Kronecker delta with size equal to dims
.
MultilayerGraphs.δk
— Typemutable struct δk{T} <: AbstractVector{T}
The Kronecker delta.
FIELDS
N::Int64
: the number of dimensions;representation::Matrix{Int64}
: the matrix representing the Kronecker delta;T
: the return type when calledδk[i,j]
.
CONSTRUCTORS
δk{T}(N::Int64) where {T <: Number}
Inner constructor that only requires N
and the eltype
.
MultilayerGraphs.δk
— Methodδk(N::Int64)
Outer constructor that only requires N
.
MultilayerGraphs.δ_1
— Typestruct δ_1{T<: Number}
The δ_1
from De Domenico et al. (2013). Evaluate it via the notation [i,j]
.
FIELDS
N:Int64
: the dimensionality ofδ_1
;T
: the return type.
CONSTRUCTORS
δ_1{T<: Number}(N::Int64)
MultilayerGraphs.δ_2
— Typestruct δ_2{T<: Number}
The δ_2
from De Domenico et al. (2013). Evaluate it via the notation [i,j]
.
FIELDS
N:Int64
: the dimensionality ofδ_2
;T
: the return type.
CONSTRUCTORS
δ_2{T<: Number}(N::Int64)
MultilayerGraphs.δ_3
— Typestruct δ_3{T<: Number}
The δ_3
from De Domenico et al. (2013). Evaluate it via the notation [i,j]
.
FIELDS
N:Int64
: the dimensionality ofδ_3
;T
: the return type.
CONSTRUCTORS
δ_3{T<: Number}(N::Int64)
MultilayerGraphs.δ_Ω
— Typeδ_Ω{T} <: AbstractVector{T}
Struct that represents the δ_Ω
defined in De Domenico et al. (2013).
FIELDS
δ_1::δ_1{T}
: Instance ofδ_1
;δ_2::δ_2{T}
: Instance ofδ_2
;δ_3::δ_3{T}
: Instance ofδ_3
;N::Int64
: Maximum index (number of layers);representation::Array{Int64,4}
: Multidimensional-array representation ofδ_Ω
.
Developer
Nodes
MultilayerGraphs.AbstractNode
— Typeabstract type AbstractNode
An abstract type representing a node.
Vertices
MultilayerGraphs.AbstractVertex
— Typeabstract type AbstractVertex
An abstract type for vertices that may not be represented by Integer and for which it may be inappropriate to use a graph with vertex-level metadata.
MultilayerGraphs.AbstractMultilayerVertex
— TypeAbstractMultilayerVertex{S} <: AbstractVertex
An abstract type representing an abstract MultilayerGraph vertex.
Edges
MultilayerGraphs.AbstractMultilayerEdge
— TypeAbstractMultilayerEdge{T} <: AbstractEdge{T}
An abstract type representing a MultilayerGraph
edge.
It must have fields: src
, dst
, weight
.
MultilayerGraphs.metadata
— Methodmetadata(he::HalfEdge)
Return the metadata associated to the edge.
SimpleWeightedGraphs.weight
— Methodweight(he::HalfEdge)
Return the weight of the edge.
Subgraphs
Graphs.has_vertex
— Methodhas_vertex( subgraph::S, v::T ) where {T,S<:AbstractSubGraph{T}}
Return true
if v
is a vertex of subgraph
.
Graphs.vertices
— Methodvertices(subgraph::AbstractSubGraph)
Return the collection of the vertices of subgraph
.
Graphs.inneighbors
— Methodinneighbors(subgraph::S, v::T) where {T, S <: AbstractSubGraph{T}}
Return the list of inneighbors of v
within subgraph
.
Graphs.inneighbors
— Methodinneighbors(subgraph::AbstractSubGraph, mv::MultilayerVertex)
Return the list of inneighbors of mv
within subgraph
.
Graphs.outneighbors
— Methodoutneighbors(subgraph::S, v::T) where {T,S<:AbstractSubGraph{T}}
Return the list of outneighbors of v
within subgraph
.
Graphs.outneighbors
— Methodoutneighbors(subgraph::AbstractSubGraph, mv::MultilayerVertex)
Return the list of outneighbors of mv
within subgraph
.
Graphs.neighbors
— Methodneighbors(subgraph::S, v::T) where {T, S <: AbstractSubGraph{T}}
Return the list of neighbors of v
within subgraph
.
Graphs.neighbors
— Methodneighbors(subgraph::AbstractSubGraph, mv::MultilayerVertex)
Return the list of neighbors of mv
within subgraph
.
Graphs.edgetype
— Methodedgetype(::S) where {T,U,S<:AbstractSubGraph{T,U}}
Return the edge type for subgraph
.
edgetype(::M) where {T,U,M<:AbstractMultilayerGraph{T,U}}
Return the edge type for mg
.
Graphs.has_edge
— Methodhas_edge( subgraph::S, s::T, d::T) where {T,S<:AbstractSubGraph{T}}
Return true
if there is an edge between s
and d
, false
otherwise.
Graphs.SimpleGraphs.add_edge!
— Methodadd_edge!(subgraph::S, src::T, dst::T; weight::W = nothing, metadata::Union{Tuple, NamedTuple}= NamedTuple()) where {T, U<: Real, W<:Union{ U, Nothing},S<:AbstractSubGraph{T,U}}
Add edge from src
to dst
with weight weight
and metadata metadata
to subgraph
.
Graphs.SimpleGraphs.rem_edge!
— Methodrem_edge!(subgraph::S, src::T, dst::T) where {T, S<:AbstractSubGraph{T}}
Remove edge from src
to dst
in a directed subgraph
.
MultilayerGraphs.AbstractLayer
— TypeAbstractLayer{T,U,G}
An abstract type representing a generic Layer.
FIELDS
T
: the node type;U
: theMultilayerEdge
weight eltype;G
: the underlying graph type.
MultilayerGraphs.Layer
— MethodLayer(
descriptor::LayerDescriptor{T},
vertices::Union{<:Vector{<:MultilayerVertex}, Vector{Node}},
edge_list::Union{Vector{<:MultilayerEdge}, Vector{NTuple{2, MultilayerVertex{nothing}}}}) where {T <: Integer}
Constructor for Layer
.
ARGUMENTS
descriptor::LayerDescriptor{T}
;vertices::Union{Vector{<:MultilayerVertex}, Vector{<:Node}}
;edge_list::Union{Vector{<:MultilayerEdge},Vector{NTuple{2, MultilayerVertex{nothing}}}}
;
Graphs.SimpleGraphs.rem_vertex!
— Methodrem_vertex!(layer::L, v::T) where {T, L <: Layer{T}}
Remove vertex v
from layer layer
.
MultilayerGraphs.AbstractInterlayer
— TypeAbstractInterlayer{T,U,G}
An abstract type representing a generic Interlayer.
PARAMETRIC TYPES
T
: the node type;U
: the adjacency matrix/tensor eltype;G
: the underlying graph type.
Multilayer-Specific Methods
Graphs.has_vertex
— Methodhas_vertex(mg::M, v::T) where {T,M <: AbstractMultilayerGraph{T}}
Return true if v
is in mg, else false.
Graphs.vertices
— Methodvertices(mg::M) where {M<:AbstractMultilayerGraph}
Return the collection of the vertices of mg
.
Graphs.inneighbors
— Methodinneighbors(mg::M, v::T) where {T,M<:AbstractMultilayerUGraph{T,<:Real}}
Return the list of inneighbors of v
within mg
.
Graphs.inneighbors
— Methodinneighbors(mg::M, v::T) where {T,M<:AbstractMultilayerGraph; IsDirected{M}}
Return the list of inneighbors of v
within mg
.
Graphs.inneighbors
— Methodinneighbors( mg::AbstractMultilayerGraph, mv::MultilayerVertex )
Return the list of inneighbors of mv
within mg
.
Graphs.outneighbors
— Methodoutneighbors(mg::M, v::T) where {T, M<:AbstractMultilayerGraph{T}}
Return the list of outneighbors of v
within mg
.
Graphs.neighbors
— Methodneighbors(mg::AbstractMultilayerGraph, mv::MultilayerVertex)
Get the neighbors of vertex mv
in mg
. Reduces to outneighbors
for both directed and undirected multilayer graphs.
Graphs.edgetype
— Methodedgetype(::S) where {T,U,S<:AbstractSubGraph{T,U}}
Return the edge type for subgraph
.
edgetype(::M) where {T,U,M<:AbstractMultilayerGraph{T,U}}
Return the edge type for mg
.
Graphs.has_edge
— Methodhas_edge( mg::M, src::T, dst::T) where {T,M<:AbstractMultilayerGraph{T};!IsDirected{M}}
Return true if mg
has edge between the src
and dst
(does not check edge or vertex metadata).
Graphs.has_edge
— Methodhas_edge(mg::M, src::T, dst::T) where {T,M<:AbstractMultilayerGraph{T}; IsDirected{M}}
Return true if mg
has edge between the src
and dst
(does not check edge or vertex metadata).
Graphs.SimpleGraphs.add_edge!
— Methodadd_edge!(mg::M, src::T, dst::T; weight::Union{Nothing, U} = one(U), metadata::Union{Tuple,NamedTuple} = NamedTuple() ) where {T,U, M <: AbstractMultilayerGraph{T,U}}
Internal method. Add a MultilayerEdge between src
and dst
with weight weight
and metadata metadata
. Return true if succeeds, false otherwise.
Graphs.SimpleGraphs.rem_edge!
— Methodrem_edge!(mg::M, src::T, dst::T) where {T, M <: AbstractMultilayerGraph{T}}
Remove edge from src
to dst
from mg
. Return true if succeeds, false otherwise.
Representations
MultilayerGraphs.AbstractTensorRepresentation
— TypeAbstractTensorRepresentation{U}
An abstract type encoding a generic tensorial representation of the links and metadata of a multilayer graph.
Concrete subtypes must have an array
field (a 4-dimensional tensor of eltype U, indexes as [sourcenodeidx, destinationnodeidx, sourcelayeridx, destinationlayeridx ]).
PARAMETRIC TYPES
U
: the weight type of the multilayer graph.
MultilayerGraphs.AbstractMatrixRepresentation
— TypeAbstractMatrixRepresentation{T,U}
An abstract type encoding a generic matrix representation of the links and metadata of a multilayer graph.
Concrete subtypes must have an array
field (a matrix of eltype U) and a v_V_associations
(a Bijection{T, Union{MissingVertex, MultilayerVertex}}
).
PARAMETRIC TYPES
T
: the type of the internal representation of vertices;U
: the weight type of the multilayer graph.
Traits
MultilayerGraphs.IsWeighted
— TypeIsWeighted{X}
Trait that discerns between weighted and unweighted graphs. A graph type should take the IsWeighted
trait IF AND ONLY IF it implements the signature add_edge!(src,dst,weight). Otherwise it should not.
MultilayerGraphs.IsMeta
— TypeIsMeta{X}
Trait that discerns between graphs that sport edge and vertex metadata.