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

Vertices

Base.eltype โ€” Function
Base.eltype(subgraph::AbstractSubGraph)

Return the vertex type of subgraph.

source
eltype(::M) where {T,M<:AbstractMultilayerGraph{T}}

Return the vertex type of mg.

source
MultilayerGraphs.MultilayerVertex โ€” Type
MultilayerVertex{N <: Integer} <: AbstractMultilayerVertex{N}

A struct representing a vertex of a MultilayerGraph.

FIELDS

  • node::Node: the Node that the MultilayerVertex represents;
  • layer::Union{Nothing, Symbol}: the name of the Layer the MultilayerVertex lies in;
  • metadata::Union{<: NamedTuple, <: Tuple}: the metadata associated to this MultilayerVertex.

CONSTRUCTORS

MultilayerVertex(node::Node, layer::Union{Nothing, Symbol},  metadata::Union{<: NamedTuple, <: Tuple})

Constructs a MultilayerVertex representing Node node in Layer with metadata metadata.

source
MultilayerGraphs.MissingVertex โ€” Type
MissingVertex

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.

source

Edges

MultilayerGraphs.MultilayerEdge โ€” Type
struct 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.

source

Subgraphs

MultilayerGraphs.Layer โ€” Type
mutable 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 .

source
MultilayerGraphs.Layer โ€” Method
Layer(
    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}}: The MultilayerVertexs of the Layer. May be a vector of MultilayerVertex{nothing}s or a vector of Nodes. In the latter case, the metadata of the MultilayerVertex to be added are computed via the default_vertex_metadata before the vertex is added (the function will act on each element of MV.(vertices));
  • edge_list::Union{Vector{<:MultilayerEdge}, Vector{NTuple{2, MultilayerVertex{nothing}}}}: The list of MultilayerEdges. It may be a vector of MultilayerEdges or a Vector of 2-tuples of MultilayerVertexs. In the latter case, the weight and the metadata of the MultilayerEdge to be added are computed respectively via the default_edge_weight and default_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 the MultilayerEdge weights (even when the underlying Layer's graph is unweighted, we need to specify a weight type since the MultilayerGraphs will always be weighted)
source
MultilayerGraphs.Layer โ€” Method
Layer(
    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}: The MultilayerVertexs of the Layer. May be a vector of MultilayerVertex{nothing}s or a vector of Nodes. In the latter case, the metadata of the MultilayerVertex to be added are computed via the default_vertex_metadata before the vertex is added (the function will act on each element of MV.(vertices));
  • name::Symbol: The name of the Layer
  • ne::Int64: The number of edges of the Layer
  • 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 the MultilayerEdge weights (even when the underlying Layer's graph is unweighted, we need to specify a weight type since the MultilayerGraphs 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 of MultilayerVertexs and returns an edge weight of type weighttype or nothing (which is compatible with unweighted underlying graphs and corresponds to one(weighttype) for weighted underlying graphs). Defaults to (src, dst) -> nothing;
  • default_edge_metadata::Function: Function that takes a pair of MultilayerVertexs and returns a Tuple or a NamedTuple containing the edge metadata, that will be called when add_edge!(mg,src,dst, args...; kwargs...) is called without the metadata keyword argument, and when generating the edges in this constructor. Defaults to (src, dst) -> NamedTuple();
  • allow_self_loops::Bool: whether to allow self loops to be generated or not. Defaults to false.
source
MultilayerGraphs.layer_simplegraph โ€” Function
layer_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}}: The MultilayerVertexs of the Layer. May be a vector of MultilayerVertex{nothing}s or a vector of Nodes. In the latter case, the metadata of the MultilayerVertex to be added are computed via the default_vertex_metadata before the vertex is added (the function will act on each element of MV.(vertices));
  • edge_list::Union{Vector{<:MultilayerEdge}, Vector{NTuple{2, MultilayerVertex{nothing}}}}: The list of MultilayerEdges. It may be a vector of MultilayerEdges or a Vector of 2-tuples of MultilayerVertexs. In the latter case, the weight and the metadata of the MultilayerEdge to be added are computed respectively via the default_edge_weight and default_edge_metadata functions;
  • vertextype::Type{T} = Int64: The type of the underlying integer labels associated to vertices.
  • weighttype::Type{U} = Float64: The type of the MultilayerEdge weights (even when the underlying Layer's graph is unweighted, we need to specify a weight type since the MultilayerGraphs will always be weighted)
source
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}}: The MultilayerVertexs of the Layer. May be a vector of MultilayerVertex{nothing}s or a vector of Nodes. In the latter case, the metadata of the MultilayerVertex to be added are computed via the default_vertex_metadata before the vertex is added (the function will act on each element of MV.(vertices));
  • 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 the MultilayerEdge weights (even when the underlying Layer's graph is unweighted, we need to specify a weight type since the MultilayerGraphs will always be weighted)
source
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}}: The MultilayerVertexs of the Layer. May be a vector of MultilayerVertex{nothing}s or a vector of Nodes. In the latter case, the metadata of the MultilayerVertex to be added are computed via the default_vertex_metadata before the vertex is added (the function will act on each element of MV.(vertices));
  • 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 the MultilayerEdge weights (even when the underlying Layer's graph is unweighted, we need to specify a weight type since the MultilayerGraphs will always be weighted)
source
MultilayerGraphs.layer_simpledigraph โ€” Function
layer_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}}: The MultilayerVertexs of the Layer. May be a vector of MultilayerVertex{nothing}s or a vector of Nodes. In the latter case, the metadata of the MultilayerVertex to be added are computed via the default_vertex_metadata before the vertex is added (the function will act on each element of MV.(vertices));
  • edge_list::Union{Vector{<:MultilayerEdge}, Vector{NTuple{2, MultilayerVertex{nothing}}}}: The list of MultilayerEdges. It may be a vector of MultilayerEdges or a Vector of 2-tuples of MultilayerVertexs. In the latter case, the weight and the metadata of the MultilayerEdge to be added are computed respectively via the default_edge_weight and default_edge_metadata functions;
  • vertextype::Type{T} = Int64: The type of the underlying integer labels associated to vertices.
  • weighttype::Type{U} = Float64: The type of the MultilayerEdge weights (even when the underlying Layer's graph is unweighted, we need to specify a weight type since the MultilayerGraphs will always be weighted)
source
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}}: The MultilayerVertexs of the Layer. May be a vector of MultilayerVertex{nothing}s or a vector of Nodes. In the latter case, the metadata of the MultilayerVertex to be added are computed via the default_vertex_metadata before the vertex is added (the function will act on each element of MV.(vertices));
  • 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 the MultilayerEdge weights (even when the underlying Layer's graph is unweighted, we need to specify a weight type since the MultilayerGraphs will always be weighted)
source
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}}: The MultilayerVertexs of the Layer. May be a vector of MultilayerVertex{nothing}s or a vector of Nodes. In the latter case, the metadata of the MultilayerVertex to be added are computed via the default_vertex_metadata before the vertex is added (the function will act on each element of MV.(vertices));
  • 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 the MultilayerEdge weights (even when the underlying Layer's graph is unweighted, we need to specify a weight type since the MultilayerGraphs will always be weighted)
source
MultilayerGraphs.layer_simpleweightedgraph โ€” Function
layer_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}}: The MultilayerVertexs of the Layer. May be a vector of MultilayerVertex{nothing}s or a vector of Nodes. In the latter case, the metadata of the MultilayerVertex to be added are computed via the default_vertex_metadata before the vertex is added (the function will act on each element of MV.(vertices));
  • edge_list::Union{Vector{<:MultilayerEdge}, Vector{NTuple{2, MultilayerVertex{nothing}}}}: The list of MultilayerEdges. It may be a vector of MultilayerEdges or a Vector of 2-tuples of MultilayerVertexs. In the latter case, the weight and the metadata of the MultilayerEdge to be added are computed respectively via the default_edge_weight and default_edge_metadata functions;
  • default_edge_weight::Function: Function that takes a pair of MultilayerVertexs and returns an edge weight of type weighttype or nothing (which is compatible with unweighted underlying graphs and corresponds to one(weighttype) for weighted underlying graphs). Defaults to (src, dst) -> nothing;
  • vertextype::Type{T} = Int64: The type of the underlying integer labels associated to vertices.
  • weighttype::Type{U} = Float64: The type of the MultilayerEdge weights (even when the underlying Layer's graph is unweighted, we need to specify a weight type since the MultilayerGraphs will always be weighted)
source
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}}: The MultilayerVertexs of the Layer. May be a vector of MultilayerVertex{nothing}s or a vector of Nodes. In the latter case, the metadata of the MultilayerVertex to be added are computed via the default_vertex_metadata before the vertex is added (the function will act on each element of MV.(vertices));
  • degree_distribution::UnivariateDistribution: The degree distribution from which the degree sequence is sampled ;
  • default_edge_weight::Function: Function that takes a pair of MultilayerVertexs and returns an edge weight of type weighttype or nothing (which is compatible with unweighted underlying graphs and corresponds to one(weighttype) for weighted underlying graphs). Defaults to (src, dst) -> nothing;
  • vertextype::Type{T} = Int64: The type of the underlying integer labels associated to vertices.
  • weighttype::Type{U} = Float64: The type of the MultilayerEdge weights (even when the underlying Layer's graph is unweighted, we need to specify a weight type since the MultilayerGraphs will always be weighted)
source
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}}: The MultilayerVertexs of the Layer. May be a vector of MultilayerVertex{nothing}s or a vector of Nodes. In the latter case, the metadata of the MultilayerVertex to be added are computed via the default_vertex_metadata before the vertex is added (the function will act on each element of MV.(vertices));
  • ne::Int64: The number of edges of the Layer;
  • default_edge_weight::Function: Function that takes a pair of MultilayerVertexs and returns an edge weight of type weighttype or nothing (which is compatible with unweighted underlying graphs and corresponds to one(weighttype) for weighted underlying graphs). Defaults to (src, dst) -> nothing;
  • vertextype::Type{T} = Int64: The type of the underlying integer labels associated to vertices.
  • weighttype::Type{U} = Float64: The type of the MultilayerEdge weights (even when the underlying Layer's graph is unweighted, we need to specify a weight type since the MultilayerGraphs will always be weighted)
source
MultilayerGraphs.layer_simpleweighteddigraph โ€” Function
layer_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}}: The MultilayerVertexs of the Layer. May be a vector of MultilayerVertex{nothing}s or a vector of Nodes. In the latter case, the metadata of the MultilayerVertex to be added are computed via the default_vertex_metadata before the vertex is added (the function will act on each element of MV.(vertices));
  • edge_list::Union{Vector{<:MultilayerEdge}, Vector{NTuple{2, MultilayerVertex{nothing}}}}: The list of MultilayerEdges. It may be a vector of MultilayerEdges or a Vector of 2-tuples of MultilayerVertexs. In the latter case, the weight and the metadata of the MultilayerEdge to be added are computed respectively via the default_edge_weight and default_edge_metadata functions;
  • default_edge_weight::Function: Function that takes a pair of MultilayerVertexs and returns an edge weight of type weighttype or nothing (which is compatible with unweighted underlying graphs and corresponds to one(weighttype) for weighted underlying graphs). Defaults to (src, dst) -> nothing;
  • vertextype::Type{T} = Int64: The type of the underlying integer labels associated to vertices.
  • weighttype::Type{U} = Float64: The type of the MultilayerEdge weights (even when the underlying Layer's graph is unweighted, we need to specify a weight type since the MultilayerGraphs will always be weighted)
source
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}}: The MultilayerVertexs of the Layer. May be a vector of MultilayerVertex{nothing}s or a vector of Nodes. In the latter case, the metadata of the MultilayerVertex to be added are computed via the default_vertex_metadata before the vertex is added (the function will act on each element of MV.(vertices));
  • 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 of MultilayerVertexs and returns an edge weight of type weighttype or nothing (which is compatible with unweighted underlying graphs and corresponds to one(weighttype) for weighted underlying graphs). Defaults to (src, dst) -> nothing;
  • vertextype::Type{T} = Int64: The type of the underlying integer labels associated to vertices.
  • weighttype::Type{U} = Float64: The type of the MultilayerEdge weights (even when the underlying Layer's graph is unweighted, we need to specify a weight type since the MultilayerGraphs will always be weighted)
source
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}}: The MultilayerVertexs of the Layer. May be a vector of MultilayerVertex{nothing}s or a vector of Nodes. In the latter case, the metadata of the MultilayerVertex to be added are computed via the default_vertex_metadata before the vertex is added (the function will act on each element of MV.(vertices));
  • ne::Int64: The number of edges of the Layer;
  • default_edge_weight::Function: Function that takes a pair of MultilayerVertexs and returns an edge weight of type weighttype or nothing (which is compatible with unweighted underlying graphs and corresponds to one(weighttype) for weighted underlying graphs). Defaults to (src, dst) -> nothing;
  • vertextype::Type{T} = Int64: The type of the underlying integer labels associated to vertices.
  • weighttype::Type{U} = Float64: The type of the MultilayerEdge weights (even when the underlying Layer's graph is unweighted, we need to specify a weight type since the MultilayerGraphs will always be weighted)
source
MultilayerGraphs.layer_metadigraph โ€” Function
layer_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}}: The MultilayerVertexs of the Layer. May be a vector of MultilayerVertex{nothing}s or a vector of Nodes. In the latter case, the metadata of the MultilayerVertex to be added are computed via the default_vertex_metadata before the vertex is added (the function will act on each element of MV.(vertices));
  • edge_list::Union{Vector{<:MultilayerEdge}, Vector{NTuple{2, MultilayerVertex{nothing}}}}: The list of MultilayerEdges. It may be a vector of MultilayerEdges or a Vector of 2-tuples of MultilayerVertexs. In the latter case, the weight and the metadata of the MultilayerEdge to be added are computed respectively via the default_edge_weight and default_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 of MultilayerVertexs and returns a Tuple or a NamedTuple containing the edge metadata, that will be called when add_edge!(mg,src,dst, args...; kwargs...) is called without the metadata keyword argument, and when generating the edges in this constructor. Defaults to (src, dst) -> NamedTuple()
  • vertextype::Type{T} = Int64: The type of the underlying integer labels associated to vertices.
  • weighttype::Type{U} = Float64: The type of the MultilayerEdge weights (even when the underlying Layer's graph is unweighted, we need to specify a weight type since the MultilayerGraphs will always be weighted)
source
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}}: The MultilayerVertexs of the Layer. May be a vector of MultilayerVertex{nothing}s or a vector of Nodes. In the latter case, the metadata of the MultilayerVertex to be added are computed via the default_vertex_metadata before the vertex is added (the function will act on each element of MV.(vertices));
  • 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 of MultilayerVertexs and returns a Tuple or a NamedTuple containing the edge metadata, that will be called when add_edge!(mg,src,dst, args...; kwargs...) is called without the metadata keyword argument, and when generating the edges in this constructor. Defaults to (src, dst) -> NamedTuple()
  • vertextype::Type{T} = Int64: The type of the underlying integer labels associated to vertices.
  • weighttype::Type{U} = Float64: The type of the MultilayerEdge weights (even when the underlying Layer's graph is unweighted, we need to specify a weight type since the MultilayerGraphs will always be weighted)
source
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}}: The MultilayerVertexs of the Layer. May be a vector of MultilayerVertex{nothing}s or a vector of Nodes. In the latter case, the metadata of the MultilayerVertex to be added are computed via the default_vertex_metadata before the vertex is added (the function will act on each element of MV.(vertices));
  • 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 of MultilayerVertexs and returns a Tuple or a NamedTuple containing the edge metadata, that will be called when add_edge!(mg,src,dst, args...; kwargs...) is called without the metadata keyword argument, and when generating the edges in this constructor. Defaults to (src, dst) -> NamedTuple()
  • vertextype::Type{T} = Int64: The type of the underlying integer labels associated to vertices.
  • weighttype::Type{U} = Float64: The type of the MultilayerEdge weights (even when the underlying Layer's graph is unweighted, we need to specify a weight type since the MultilayerGraphs will always be weighted)
source
MultilayerGraphs.layer_valgraph โ€” Function
layer_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}}: The MultilayerVertexs of the Layer. May be a vector of MultilayerVertex{nothing}s or a vector of Nodes. In the latter case, the metadata of the MultilayerVertex to be added are computed via the default_vertex_metadata before the vertex is added (the function will act on each element of MV.(vertices));
  • edge_list::Union{Vector{<:MultilayerEdge}, Vector{NTuple{2, MultilayerVertex{nothing}}}}: The list of MultilayerEdges. It may be a vector of MultilayerEdges or a Vector of 2-tuples of MultilayerVertexs. In the latter case, the weight and the metadata of the MultilayerEdge to be added are computed respectively via the default_edge_weight and default_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 of MultilayerVertexs and returns a Tuple or a NamedTuple containing the edge metadata, that will be called when add_edge!(mg,src,dst, args...; kwargs...) is called without the metadata keyword argument, and when generating the edges in this constructor. Defaults to (src, dst) -> NamedTuple()
  • vertextype::Type{T} = Int64: The type of the underlying integer labels associated to vertices.
  • weighttype::Type{U} = Float64: The type of the MultilayerEdge weights (even when the underlying Layer's graph is unweighted, we need to specify a weight type since the MultilayerGraphs will always be weighted)
source
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}}: The MultilayerVertexs of the Layer. May be a vector of MultilayerVertex{nothing}s or a vector of Nodes. In the latter case, the metadata of the MultilayerVertex to be added are computed via the default_vertex_metadata before the vertex is added (the function will act on each element of MV.(vertices));
  • 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 of MultilayerVertexs and returns a Tuple or a NamedTuple containing the edge metadata, that will be called when add_edge!(mg,src,dst, args...; kwargs...) is called without the metadata keyword argument, and when generating the edges in this constructor. Defaults to (src, dst) -> NamedTuple()
  • vertextype::Type{T} = Int64: The type of the underlying integer labels associated to vertices.
  • weighttype::Type{U} = Float64: The type of the MultilayerEdge weights (even when the underlying Layer's graph is unweighted, we need to specify a weight type since the MultilayerGraphs will always be weighted)
source
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}}: The MultilayerVertexs of the Layer. May be a vector of MultilayerVertex{nothing}s or a vector of Nodes. In the latter case, the metadata of the MultilayerVertex to be added are computed via the default_vertex_metadata before the vertex is added (the function will act on each element of MV.(vertices));
  • 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 of MultilayerVertexs and returns a Tuple or a NamedTuple containing the edge metadata, that will be called when add_edge!(mg,src,dst, args...; kwargs...) is called without the metadata keyword argument, and when generating the edges in this constructor. Defaults to (src, dst) -> NamedTuple()
  • vertextype::Type{T} = Int64: The type of the underlying integer labels associated to vertices.
  • weighttype::Type{U} = Float64: The type of the MultilayerEdge weights (even when the underlying Layer's graph is unweighted, we need to specify a weight type since the MultilayerGraphs will always be weighted)
source
MultilayerGraphs.layer_valoutdigraph โ€” Function
layer_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}}: The MultilayerVertexs of the Layer. May be a vector of MultilayerVertex{nothing}s or a vector of Nodes. In the latter case, the metadata of the MultilayerVertex to be added are computed via the default_vertex_metadata before the vertex is added (the function will act on each element of MV.(vertices));
  • edge_list::Union{Vector{<:MultilayerEdge}, Vector{NTuple{2, MultilayerVertex{nothing}}}}: The list of MultilayerEdges. It may be a vector of MultilayerEdges or a Vector of 2-tuples of MultilayerVertexs. In the latter case, the weight and the metadata of the MultilayerEdge to be added are computed respectively via the default_edge_weight and default_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 of MultilayerVertexs and returns a Tuple or a NamedTuple containing the edge metadata, that will be called when add_edge!(mg,src,dst, args...; kwargs...) is called without the metadata keyword argument, and when generating the edges in this constructor. Defaults to (src, dst) -> NamedTuple()
  • vertextype::Type{T} = Int64: The type of the underlying integer labels associated to vertices.
  • weighttype::Type{U} = Float64: The type of the MultilayerEdge weights (even when the underlying Layer's graph is unweighted, we need to specify a weight type since the MultilayerGraphs will always be weighted)
source
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}}: The MultilayerVertexs of the Layer. May be a vector of MultilayerVertex{nothing}s or a vector of Nodes. In the latter case, the metadata of the MultilayerVertex to be added are computed via the default_vertex_metadata before the vertex is added (the function will act on each element of MV.(vertices));
  • 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 of MultilayerVertexs and returns a Tuple or a NamedTuple containing the edge metadata, that will be called when add_edge!(mg,src,dst, args...; kwargs...) is called without the metadata keyword argument, and when generating the edges in this constructor. Defaults to (src, dst) -> NamedTuple(), 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 the MultilayerEdge weights (even when the underlying Layer's graph is unweighted, we need to specify a weight type since the MultilayerGraphs will always be weighted)
source
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}}: The MultilayerVertexs of the Layer. May be a vector of MultilayerVertex{nothing}s or a vector of Nodes. In the latter case, the metadata of the MultilayerVertex to be added are computed via the default_vertex_metadata before the vertex is added (the function will act on each element of MV.(vertices));
  • 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 of MultilayerVertexs and returns a Tuple or a NamedTuple containing the edge metadata, that will be called when add_edge!(mg,src,dst, args...; kwargs...) is called without the metadata keyword argument, and when generating the edges in this constructor. Defaults to (src, dst) -> NamedTuple(), 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 the MultilayerEdge weights (even when the underlying Layer's graph is unweighted, we need to specify a weight type since the MultilayerGraphs will always be weighted)
source
MultilayerGraphs.layer_valdigraph โ€” Function
layer_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}}: The MultilayerVertexs of the Layer. May be a vector of MultilayerVertex{nothing}s or a vector of Nodes. In the latter case, the metadata of the MultilayerVertex to be added are computed via the default_vertex_metadata before the vertex is added (the function will act on each element of MV.(vertices));
  • edge_list::Union{Vector{<:MultilayerEdge}, Vector{NTuple{2, MultilayerVertex{nothing}}}}: The list of MultilayerEdges. It may be a vector of MultilayerEdges or a Vector of 2-tuples of MultilayerVertexs. In the latter case, the weight and the metadata of the MultilayerEdge to be added are computed respectively via the default_edge_weight and default_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 of MultilayerVertexs and returns a Tuple or a NamedTuple containing the edge metadata, that will be called when add_edge!(mg,src,dst, args...; kwargs...) is called without the metadata keyword argument, and when generating the edges in this constructor. Defaults to (src, dst) -> NamedTuple()
  • vertextype::Type{T} = Int64: The type of the underlying integer labels associated to vertices.
  • weighttype::Type{U} = Float64: The type of the MultilayerEdge weights (even when the underlying Layer's graph is unweighted, we need to specify a weight type since the MultilayerGraphs will always be weighted)
source
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}}: The MultilayerVertexs of the Layer. May be a vector of MultilayerVertex{nothing}s or a vector of Nodes. In the latter case, the metadata of the MultilayerVertex to be added are computed via the default_vertex_metadata before the vertex is added (the function will act on each element of MV.(vertices));
  • 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 of MultilayerVertexs and returns a Tuple or a NamedTuple containing the edge metadata, that will be called when add_edge!(mg,src,dst, args...; kwargs...) is called without the metadata keyword argument, and when generating the edges in this constructor. Defaults to (src, dst) -> NamedTuple(), 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 the MultilayerEdge weights (even when the underlying Layer's graph is unweighted, we need to specify a weight type since the MultilayerGraphs will always be weighted)
source
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}}: The MultilayerVertexs of the Layer. May be a vector of MultilayerVertex{nothing}s or a vector of Nodes. In the latter case, the metadata of the MultilayerVertex to be added are computed via the default_vertex_metadata before the vertex is added (the function will act on each element of MV.(vertices));
  • 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 of MultilayerVertexs and returns a Tuple or a NamedTuple containing the edge metadata, that will be called when add_edge!(mg,src,dst, args...; kwargs...) is called without the metadata keyword argument, and when generating the edges in this constructor. Defaults to (src, dst) -> NamedTuple(), 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 the MultilayerEdge weights (even when the underlying Layer's graph is unweighted, we need to specify a weight type since the MultilayerGraphs will always be weighted)
source
MultilayerGraphs.layer_metagraph โ€” Function
layer_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}}: The MultilayerVertexs of the Layer. May be a vector of MultilayerVertex{nothing}s or a vector of Nodes. In the latter case, the metadata of the MultilayerVertex to be added are computed via the default_vertex_metadata before the vertex is added (the function will act on each element of MV.(vertices));
  • edge_list::Union{Vector{<:MultilayerEdge}, Vector{NTuple{2, MultilayerVertex{nothing}}}}: The list of MultilayerEdges. It may be a vector of MultilayerEdges or a Vector of 2-tuples of MultilayerVertexs. In the latter case, the weight and the metadata of the MultilayerEdge to be added are computed respectively via the default_edge_weight and default_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 of MultilayerVertexs and returns a Tuple or a NamedTuple containing the edge metadata, that will be called when add_edge!(mg,src,dst, args...; kwargs...) is called without the metadata keyword argument, and when generating the edges in this constructor. Defaults to (src, dst) -> NamedTuple()
  • vertextype::Type{T} = Int64: The type of the underlying integer labels associated to vertices.
  • weighttype::Type{U} = Float64: The type of the MultilayerEdge weights (even when the underlying Layer's graph is unweighted, we need to specify a weight type since the MultilayerGraphs will always be weighted)
source
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}}: The MultilayerVertexs of the Layer. May be a vector of MultilayerVertex{nothing}s or a vector of Nodes. In the latter case, the metadata of the MultilayerVertex to be added are computed via the default_vertex_metadata before the vertex is added (the function will act on each element of MV.(vertices));
  • 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 of MultilayerVertexs and returns a Tuple or a NamedTuple containing the edge metadata, that will be called when add_edge!(mg,src,dst, args...; kwargs...) is called without the metadata keyword argument, and when generating the edges in this constructor. Defaults to (src, dst) -> NamedTuple()
  • vertextype::Type{T} = Int64: The type of the underlying integer labels associated to vertices.
  • weighttype::Type{U} = Float64: The type of the MultilayerEdge weights (even when the underlying Layer's graph is unweighted, we need to specify a weight type since the MultilayerGraphs will always be weighted)
source
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}}: The MultilayerVertexs of the Layer. May be a vector of MultilayerVertex{nothing}s or a vector of Nodes. In the latter case, the metadata of the MultilayerVertex to be added are computed via the default_vertex_metadata before the vertex is added (the function will act on each element of MV.(vertices));
  • 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 of MultilayerVertexs and returns a Tuple or a NamedTuple containing the edge metadata, that will be called when add_edge!(mg,src,dst, args...; kwargs...) is called without the metadata keyword argument, and when generating the edges in this constructor. Defaults to (src, dst) -> NamedTuple()
  • vertextype::Type{T} = Int64: The type of the underlying integer labels associated to vertices.
  • weighttype::Type{U} = Float64: The type of the MultilayerEdge weights (even when the underlying Layer's graph is unweighted, we need to specify a weight type since the MultilayerGraphs will always be weighted)
source
Graphs.SimpleGraphs.add_vertex! โ€” Method
add_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.

source
MultilayerGraphs.Interlayer โ€” Type
Interlayer{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 .

source
MultilayerGraphs.Interlayer โ€” Method
Interlayer(
    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 of MultilayerEdges. It may be a vector of MultilayerEdges or a Vector of 2-tuples of MultilayerVertexs. In the latter case, the weight and the metadata of the MultilayerEdge to be added are computed respectively via the default_edge_weight and default_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 of MultilayerVertexs and returns an edge weight of type weighttype or nothing (which is compatible with unweighted underlying graphs and corresponds to one(weighttype) for weighted underlying graphs). Defaults to (src, dst) -> nothing;
  • default_edge_metadata::Function: Function that takes a pair of MultilayerVertexs and returns a Tuple or a NamedTuple containing the edge metadata, that will be called when add_edge!(mg,src,dst, args...; kwargs...) is called without the metadata keyword argument, and when generating the edges in this constructor. Defaults to (src, dst) -> NamedTuple();
  • 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.
source
MultilayerGraphs.Interlayer โ€” Method
Interlayer(
    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 of MultilayerVertexs and returns an edge weight of type weighttype or nothing (which is compatible with unweighted underlying graphs and corresponds to one(weighttype) for weighted underlying graphs). Defaults to (src, dst) -> nothing;
  • default_edge_metadata::Function: Function that takes a pair of MultilayerVertexs and returns a Tuple or a NamedTuple containing the edge metadata, that will be called when add_edge!(mg,src,dst, args...; kwargs...) is called without the metadata keyword argument, and when generating the edges in this constructor. Defaults to (src, dst) -> NamedTuple();
  • 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.
source
MultilayerGraphs.interlayer_simplegraph โ€” Function
interlayer_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 of MultilayerEdges. It may be a vector of MultilayerEdges or a Vector of 2-tuples of MultilayerVertexs. In the latter case, the weight and the metadata of the MultilayerEdge to be added are computed respectively via the default_edge_weight and default_edge_metadata functions;

KWARGS

  • interlayer_name::Symbol: The name of the Interlayer. Defaults to Symbol("interlayer(layer1.name)(layer2.name)");
source
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)");
source
MultilayerGraphs.interlayer_simpleweightedgraph โ€” Function
interlayer_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 of MultilayerEdges. It may be a vector of MultilayerEdges or a Vector of 2-tuples of MultilayerVertexs. In the latter case, the weight and the metadata of the MultilayerEdge to be added are computed respectively via the default_edge_weight and default_edge_metadata functions;

KWARGS

  • default_edge_weight::Function: Function that takes a pair of MultilayerVertexs and returns an edge weight of type weighttype or nothing (which is compatible with unweighted underlying graphs and corresponds to one(weighttype) for weighted underlying graphs). Defaults to (src, dst) -> nothing;
  • interlayer_name::Symbol: The name of the Interlayer. Defaults to Symbol("interlayer(layer1.name)(layer2.name)");
source
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 of MultilayerVertexs and returns an edge weight of type weighttype or nothing (which is compatible with unweighted underlying graphs and corresponds to one(weighttype) for weighted underlying graphs). Defaults to (src, dst) -> nothing;
  • interlayer_name::Symbol: The name of the Interlayer. Defaults to Symbol("interlayer(layer1.name)(layer2.name)");
source
MultilayerGraphs.interlayer_metagraph โ€” Function
interlayer_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 of MultilayerEdges. It may be a vector of MultilayerEdges or a Vector of 2-tuples of MultilayerVertexs. In the latter case, the weight and the metadata of the MultilayerEdge to be added are computed respectively via the default_edge_weight and default_edge_metadata functions;

KWARGS

  • default_edge_metadata::Function: Function that takes a pair of MultilayerVertexs and returns a Tuple or a NamedTuple containing the edge metadata, that will be called when add_edge!(mg,src,dst, args...; kwargs...) is called without the metadata keyword argument, and when generating the edges in this constructor. Defaults to (src, dst) -> NamedTuple();
  • 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)");
source
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 of MultilayerVertexs and returns a Tuple or a NamedTuple containing the edge metadata, that will be called when add_edge!(mg,src,dst, args...; kwargs...) is called without the metadata keyword argument, and when generating the edges in this constructor. Defaults to (src, dst) -> NamedTuple();
  • 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)");
source
MultilayerGraphs.interlayer_valgraph โ€” Function
interlayer_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 of MultilayerEdges. It may be a vector of MultilayerEdges or a Vector of 2-tuples of MultilayerVertexs. In the latter case, the weight and the metadata of the MultilayerEdge to be added are computed respectively via the default_edge_weight and default_edge_metadata functions;

KWARGS

  • default_edge_metadata::Function: Function that takes a pair of MultilayerVertexs and returns a Tuple or a NamedTuple containing the edge metadata, that will be called when add_edge!(mg,src,dst, args...; kwargs...) is called without the metadata keyword argument, and when generating the edges in this constructor. Defaults to (src, dst) -> NamedTuple();
  • interlayer_name::Symbol: The name of the Interlayer. Defaults to Symbol("interlayer(layer1.name)(layer2.name)");
source
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 of MultilayerVertexs and returns a Tuple or a NamedTuple containing the edge metadata, that will be called when add_edge!(mg,src,dst, args...; kwargs...) is called without the metadata keyword argument, and when generating the edges in this constructor. Defaults to (src, dst) -> NamedTuple();
  • interlayer_name::Symbol: The name of the Interlayer. Defaults to Symbol("interlayer(layer1.name)(layer2.name)");
source
MultilayerGraphs.interlayer_simpledigraph โ€” Function
interlayer_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 of MultilayerEdges. It may be a vector of MultilayerEdges or a Vector of 2-tuples of MultilayerVertexs. In the latter case, the weight and the metadata of the MultilayerEdge to be added are computed respectively via the default_edge_weight and default_edge_metadata functions;

KWARGS

  • interlayer_name::Symbol: The name of the Interlayer. Defaults to Symbol("interlayer(layer1.name)(layer2.name)");
source
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)");
source
MultilayerGraphs.interlayer_simpleweighteddigraph โ€” Function
interlayer_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 of MultilayerEdges. It may be a vector of MultilayerEdges or a Vector of 2-tuples of MultilayerVertexs. In the latter case, the weight and the metadata of the MultilayerEdge to be added are computed respectively via the default_edge_weight and default_edge_metadata functions;

KWARGS

  • default_edge_weight::Function: Function that takes a pair of MultilayerVertexs and returns an edge weight of type weighttype or nothing (which is compatible with unweighted underlying graphs and corresponds to one(weighttype) for weighted underlying graphs). Defaults to (src, dst) -> nothing;
  • interlayer_name::Symbol: The name of the Interlayer. Defaults to Symbol("interlayer(layer1.name)(layer2.name)");
source
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 of MultilayerVertexs and returns an edge weight of type weighttype or nothing (which is compatible with unweighted underlying graphs and corresponds to one(weighttype) for weighted underlying graphs). Defaults to (src, dst) -> nothing;
  • interlayer_name::Symbol: The name of the Interlayer. Defaults to Symbol("interlayer(layer1.name)(layer2.name)");
source
MultilayerGraphs.interlayer_metadigraph โ€” Function
interlayer_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 of MultilayerEdges. It may be a vector of MultilayerEdges or a Vector of 2-tuples of MultilayerVertexs. In the latter case, the weight and the metadata of the MultilayerEdge to be added are computed respectively via the default_edge_weight and default_edge_metadata functions;

KWARGS

  • default_edge_metadata::Function: Function that takes a pair of MultilayerVertexs and returns a Tuple or a NamedTuple containing the edge metadata, that will be called when add_edge!(mg,src,dst, args...; kwargs...) is called without the metadata keyword argument, and when generating the edges in this constructor. Defaults to (src, dst) -> NamedTuple();
  • 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)");
source
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 of MultilayerVertexs and returns a Tuple or a NamedTuple containing the edge metadata, that will be called when add_edge!(mg,src,dst, args...; kwargs...) is called without the metadata keyword argument, and when generating the edges in this constructor. Defaults to (src, dst) -> NamedTuple();
  • 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)");
source
MultilayerGraphs.interlayer_valoutdigraph โ€” Function
interlayer_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 of MultilayerEdges. It may be a vector of MultilayerEdges or a Vector of 2-tuples of MultilayerVertexs. In the latter case, the weight and the metadata of the MultilayerEdge to be added are computed respectively via the default_edge_weight and default_edge_metadata functions;

KWARGS

  • default_edge_metadata::Function: Function that takes a pair of MultilayerVertexs and returns a Tuple or a NamedTuple containing the edge metadata, that will be called when add_edge!(mg,src,dst, args...; kwargs...) is called without the metadata keyword argument, and when generating the edges in this constructor. Defaults to (src, dst) -> NamedTuple();
  • interlayer_name::Symbol: The name of the Interlayer. Defaults to Symbol("interlayer(layer1.name)(layer2.name)");
source
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 of MultilayerVertexs and returns a Tuple or a NamedTuple containing the edge metadata, that will be called when add_edge!(mg,src,dst, args...; kwargs...) is called without the metadata keyword argument, and when generating the edges in this constructor. Defaults to (src, dst) -> NamedTuple();
  • interlayer_name::Symbol: The name of the Interlayer. Defaults to Symbol("interlayer(layer1.name)(layer2.name)");
source
MultilayerGraphs.interlayer_valdigraph โ€” Function
interlayer_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 of MultilayerEdges. It may be a vector of MultilayerEdges or a Vector of 2-tuples of MultilayerVertexs. In the latter case, the weight and the metadata of the MultilayerEdge to be added are computed respectively via the default_edge_weight and default_edge_metadata functions;

KWARGS

  • default_edge_metadata::Function: Function that takes a pair of MultilayerVertexs and returns a Tuple or a NamedTuple containing the edge metadata, that will be called when add_edge!(mg,src,dst, args...; kwargs...) is called without the metadata keyword argument, and when generating the edges in this constructor. Defaults to (src, dst) -> NamedTuple();
  • interlayer_name::Symbol: The name of the Interlayer. Defaults to Symbol("interlayer(layer1.name)(layer2.name)");
source
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 of MultilayerVertexs and returns a Tuple or a NamedTuple containing the edge metadata, that will be called when add_edge!(mg,src,dst, args...; kwargs...) is called without the metadata keyword argument, and when generating the edges in this constructor. Defaults to (src, dst) -> NamedTuple();
  • interlayer_name::Symbol: The name of the Interlayer. Defaults to Symbol("interlayer(layer1.name)(layer2.name)");
source
MultilayerGraphs.multiplex_interlayer โ€” Method
multiplex_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 of MultilayerVertexs and returns an edge weight of type weighttype or nothing (which is compatible with unweighted underlying graphs and corresponds to one(weighttype) for weighted underlying graphs). Defaults to (src, dst) -> nothing;
  • default_edge_metadata::Function: Function that takes a pair of MultilayerVertexs and returns a Tuple or a NamedTuple containing the edge metadata, that will be called when add_edge!(mg,src,dst, args...; kwargs...) is called without the metadata keyword argument, and when generating the edges in this constructor. Defaults to (src, dst) -> NamedTuple();
  • 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;
source
MultilayerGraphs.empty_interlayer โ€” Method
empty_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 of MultilayerVertexs and returns an edge weight of type weighttype or nothing (which is compatible with unweighted underlying graphs and corresponds to one(weighttype) for weighted underlying graphs). Defaults to (src, dst) -> nothing;
  • default_edge_metadata::Function: Function that takes a pair of MultilayerVertexs and returns a Tuple or a NamedTuple containing the edge metadata, that will be called when add_edge!(mg,src,dst, args...; kwargs...) is called without the metadata keyword argument, and when generating the edges in this constructor. Defaults to (src, dst) -> NamedTuple();
  • 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;
source
Graphs.has_vertex โ€” Method
has_vertex(layer::Layer, mv::MultilayerVertex)

Return true if v is a vertex of layer.

source
Graphs.has_vertex โ€” Method
has_vertex(interlayer::Interlayer, v::MultilayerVertex)

Return true if v is a vertex of interlayer.

source
Graphs.nv โ€” Method
nv(subgraph::AbstractSubGraph)

Return the number of vertices in subgraph.

source
Graphs.has_edge โ€” Method
has_edge(subgraph::AbstractSubGraph,me::MultilayerEdge)

Return true if there is an edge from src(me) to dst(me) within subgraph, false otherwise.

source
Graphs.has_edge โ€” Method
has_edge( subgraph::AbstractSubGraph, s::MultilayerVertex, d::MultilayerVertex)

Return true if there is an edge between s and d, false otherwise.

source
Graphs.has_edge โ€” Method
has_edge( layer::Layer, s::MultilayerVertex{nothing}, d::MultilayerVertex{nothing})

Return true if there is an edge between s and d, false otherwise.

source
Graphs.ne โ€” Method
ne(subgraph::AbstractSubGraph)

Return the number of edges in subgraph.

source
Graphs.edges โ€” Method
edges(subgraph::S) where {T,U,S<:AbstractSubGraph{T,U}}

Return an iterator over all the edges of subgraph.

source
Graphs.SimpleGraphs.add_edge! โ€” Method
add_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.

source
Graphs.SimpleGraphs.add_edge! โ€” Method
add_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.

source
MultilayerGraphs.get_metadata โ€” Method
get_metadata(subgraph::AbstractSubGraph, bare_mv::MultilayerVertex)

Return the metadata of the vertex bare_mv in subgraph (metadata assigned to bare_mv will be discarded).

source
MultilayerGraphs.get_metadata โ€” Method
get_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.

source
SimpleWeightedGraphs.get_weight โ€” Method
get_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.

source
Graphs.is_directed โ€” Method
is_directed(subgraph::AbstractSubGraph)

Return true if subgraph is directed, false otherwise.

source
Graphs.is_directed โ€” Method
is_directed(::Type{S}) where {T,U,G,S <: AbstractSubGraph{T,U,G}}

Return true if instances of S are directed, false otherwise.

source
Graphs.weights โ€” Method
weights(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.

source
MultilayerGraphs.get_symmetric_interlayer โ€” Method
get_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 tointerlayer(interlayer.layer2)(interlayer.layer_1)`).

source

Multilayer-Specific Methods

MultilayerGraphs.AbstractMultilayerGraph โ€” Type
AbstractMultilayerGraph{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 of Layers.
  • interlayers:a collection of Interlayers;
  • 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.
source
MultilayerGraphs.nodes โ€” Method
nodes(mg::AbstractMultilayerGraph

Return the nodes of the AbstractMultilayerGraph mg, in order of addition.

source
Graphs.has_vertex โ€” Method
has_vertex(mg::AbstractMultilayerGraph, mv::MultilayerVertex)

Return true if mv is in mg, else false.

source
Graphs.nv โ€” Method
nv(mg::M) where {M <: AbstractMultilayerGraph }

Return the number of vertices in mg, excluding the missing vertices.

source
MultilayerGraphs.get_metadata โ€” Method
get_metadata(mg::AbstractMultilayerGraph, bare_mv::MultilayerVertex)

Return the metadata associated to MultilayerVertex mv (regardless of metadata assigned to bare_mv).

source
MultilayerGraphs.set_metadata! โ€” Method
set_metadata!(mg::AbstractMultilayerGraph, mv::MultilayerVertex, metadata::Union{Tuple, NamedTuple})

Set the metadata of vertex mv to metadata. Return true if succeeds

source
MultilayerGraphs.mv_neighbors โ€” Method
mv_neighbors(mg::AbstractMultilayerGraph, mv::MultilayerVertex)

Return the list of MultilayerVertex neighbors of mv within mg.

source
Graphs.has_edge โ€” Method
has_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).

source
Graphs.has_edge โ€” Method
has_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).

source
Graphs.ne โ€” Method
ne(mg::AbstractMultilayerGraph)

Return the number of edges in mg.

source
Graphs.edges โ€” Method
edges(mg::M) where {T,U,M<:AbstractMultilayerGraph{T,U}; IsDirected{M}}

Return an list of all the edges of mg.

source
Graphs.edges โ€” Method
edges(mg::M) where {T,U,M<:AbstractMultilayerGraph{T,U}; !IsDirected{M}}

Return an list of all the edges of mg.

source
Graphs.SimpleGraphs.add_edge! โ€” Method
add_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.

source
Graphs.SimpleGraphs.rem_edge! โ€” Method
rem_edge!(mg::AbstractMultilayerGraph, me::MultilayerEdge)

Remove edge from src(me) to dst(me) from mg. Return true if succeeds, false otherwise.

source
MultilayerGraphs.get_metadata โ€” Method
get_metadata(mg::AbstractMultilayerGraph, src::MultilayerVertex, dst::MultilayerVertex)

Return the metadata associated to the MultilayerEdge from src to dst.

source
SimpleWeightedGraphs.get_weight โ€” Method
get_weight(mg::AbstractMultilayerGraph, src::MultilayerVertex, dst::MultilayerVertex)h

Return the weight associated to the MultilayerEdge from src to dst.

source
MultilayerGraphs.set_weight! โ€” Method
set_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).

source
MultilayerGraphs.set_weight! โ€” Method
set_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).

source
MultilayerGraphs.set_metadata! โ€” Method
set_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).

source
MultilayerGraphs.set_metadata! โ€” Method
set_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).

source
MultilayerGraphs.has_layer โ€” Method
has_layer(mg::AbstractMultilayerGraph, layer_name::Symbol)

Return true in layer_name is a name of a [Layer](@ref) of mg.

source
MultilayerGraphs.add_layer! โ€” Method
add_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: the MultilayerGraph which the new layer will be added to;
  • new_layer::L: the new Layer to add to mg;
  • default_interlayers_null_graph::H = SimpleGraph{T}(): upon addition of a new Layer, all the Interlayers between the new and the existing Layers are immediately created. This keyword argument specifies their null_graph See the Layer constructor for more information. Defaults to SimpleGraph{T}();
  • default_interlayers_structure::String = "multiplex": The structure of the Interlayers created by default. May either be "multiplex" to have diagonally-coupled only interlayers, or "empty" for empty interlayers. Defaults to "multiplex".
source
MultilayerGraphs.add_layer! โ€” Method
add_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: the MultilayerDiGraph which the new layer will be added to;
  • new_layer::L: the new Layer to add to mg;
  • default_interlayers_null_graph::H: upon addition of a new Layer, all the Interlayers between the new and the existing Layers are immediately created. This keyword argument specifies their null_graph See the Layer constructor for more information. Defaults to SimpleGraph{T}();
  • default_interlayers_structure::String: The structure of the Interlayers created by default. May either be "multiplex" to have diagonally-coupled only interlayers, or "empty" for empty interlayers. Defaults to "multiplex".
source
MultilayerGraphs.specify_interlayer! โ€” Method
specify_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.

source
MultilayerGraphs.specify_interlayer! โ€” Method
specify_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.

source
MultilayerGraphs.get_interlayer โ€” Method
get_interlayer(
    mg::AbstractMultilayerGraph, layer_1_name::Symbol, 
    layer_2_name::Symbol
)

Return the Interlayer between layer_1 and layer_2.

source
Graphs.indegree โ€” Method
indegree( mg::AbstractMultilayerGraph, v::MultilayerVertex)

Get the indegree of vertex v in mg.

source
Graphs.indegree โ€” Function
indegree( 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.

source
Graphs.outdegree โ€” Method
outdegree(mg::AbstractMultilayerGraph, mv::MultilayerVertex)

Get the outdegree of vertex v in mg.

source
Graphs.outdegree โ€” Function
outdegree(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.

source
Graphs.degree โ€” Method
degree(mg::AbstractMultilayerGraph, vs::AbstractVector{<:MultilayerVertex}=vertices(mg))

Get the degree of vertices vs in mg.

source
Graphs.degree โ€” Method
degree(
    mg::M, mv::V
) where {M<:AbstractMultilayerGraph, V<:MultilayerVertex;  IsDirected{M}}

Return the degree of MultilayerVertex v within mg.

source
Graphs.degree โ€” Method
degree(mg::M, v::V) where {T,M<:AbstractMultilayerUGraph{T,<:Real},V<:MultilayerVertex}

Return the degree of MultilayerVertex v within mg.

source
MultilayerGraphs.weighttype โ€” Method
weighttype(::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).

source
MultilayerGraphs.multilayer_global_clustering_coefficient โ€” Function
multilayer_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).

source
Graphs.eigenvector_centrality โ€” Method
eigenvector_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.

source
Graphs.modularity โ€” Method
modularity(
    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).

source

Concrete Multilayer Graphs

(General) Multilayer Graphs

MultilayerGraph
MultilayerGraphs.MultilayerGraph โ€” Type
MultilayerGraph{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.

source
MultilayerGraphs.MultilayerGraph โ€” Method
MultilayerGraph(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.

source
MultilayerGraphs.MultilayerGraph โ€” Method
MultilayerGraph(
    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 the default_interlayers_null_graph and default_interlayers_structure keywords;
  • default_interlayers_null_graph::H = SimpleGraph{T}(): Sets the underlying graph for the interlayers that are to be automatically specified. Defaults to SimpleGraph{T}(). See the Interlayer 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 the Interlayer constructors for more information.
source
MultilayerGraphs.MultilayerGraph โ€” Method
MultilayerGraph(
    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 Layers and Interlayers 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.

source
MultilayerGraphs.MultilayerGraph โ€” Method
MultilayerGraph(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.

source
MultilayerGraphs.add_node! โ€” Method
add_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.

source
Graphs.SimpleGraphs.add_vertex! โ€” Method
add_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.

source
Graphs.SimpleGraphs.add_edge! โ€” Method
add_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.

source
Graphs.SimpleGraphs.rem_edge! โ€” Method
rem_edge!(mg::MultilayerGraph, me::MultilayerEdge)

Remove edge from src(me) to dst(me) from mg. Return true if succeeds, false otherwise.

source
MultilayerDiGraph
MultilayerGraphs.MultilayerDiGraph โ€” Type
MultilayerDiGraph{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.

source
MultilayerGraphs.MultilayerDiGraph โ€” Method
MultilayerDiGraph(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.

source
MultilayerGraphs.MultilayerDiGraph โ€” Method
MultilayerDiGraph(
    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.

source
MultilayerGraphs.MultilayerDiGraph โ€” Method
MultilayerDiGraph(
    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 Layers and Interlayers 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.

source
MultilayerGraphs.MultilayerDiGraph โ€” Method
MultilayerDiGraph(
    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.

source
MultilayerGraphs.add_node! โ€” Method
add_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.

source
Graphs.SimpleGraphs.add_vertex! โ€” Method
add_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.

source
Graphs.SimpleGraphs.add_edge! โ€” Method
add_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.

source
Graphs.SimpleGraphs.rem_edge! โ€” Method
rem_edge!(mg::MultilayerDiGraph, me::MultilayerEdge)

Remove edge from src(me) to dst(me) from mg. Return true if succeeds, false otherwise.

source

Node Aligned Edge Colored Graphs

MultilayerGraphs.AbstractNodeAlignedEdgeColoredGraph โ€” Type
AbstractNodeAlignedEdgeColoredGraph{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! and rem_vertex! are not available for this type;
  • All Interlayers automatically added by add_layer! are empty simple graphs.
  • specify_interlayer! is not available.
source
MultilayerGraphs.add_node! โ€” Method
add_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.

source
Graphs.SimpleGraphs.add_edge! โ€” Method
add_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.

source
Graphs.SimpleGraphs.rem_edge! โ€” Method
rem_edge!(mg::AbstractNodeAlignedEdgeColoredGraph, me::MultilayerEdge)

Remove edge from src(me) to dst(me) from mg. Return true if succeeds, false otherwise.

source
MultilayerGraphs.add_layer! โ€” Method
add_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: the AbstractNodeAlignedEdgeColoredGraph which the new layer will be added to;
  • new_layer::L: the new Layer to add to mg;
source
NodeAlignedEdgeColoredGraph
MultilayerGraphs.NodeAlignedEdgeColoredGraph โ€” Type
NodeAlignedEdgeColoredGraph{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! and rem_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.

source
MultilayerGraphs.NodeAlignedEdgeColoredGraph โ€” Method
NodeAlignedEdgeColoredGraph(
    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;
source
Graphs.is_directed โ€” Method
is_directed(m::M) where { M <: Type{ <: NodeAlignedEdgeColoredGraph}}

Return false

source
NodeAlignedEdgeColoredDiGraph
MultilayerGraphs.NodeAlignedEdgeColoredDiGraph โ€” Type
NodeAlignedEdgeColoredDiGraph{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! and rem_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.

source
MultilayerGraphs.NodeAlignedEdgeColoredDiGraph โ€” Method
NodeAlignedEdgeColoredDiGraph(
    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;
source
Graphs.is_directed โ€” Method
is_directed(m::M) where { M <: Type{ <: NodeAlignedEdgeColoredDiGraph}}

Return false

source

Representations

MultilayerGraphs.WeightTensor โ€” Type
WeightTensor{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]
source
MultilayerGraphs.weight_tensor โ€” Method
weight_tensor(mg::M) where {T,U, M <: AbstractMultilayerGraph{T,U}}

Compute the weight tensor of mg. Return an object of type WeightTensor.

source
MultilayerGraphs.MetadataTensor โ€” Type
MetadataTensor{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]
source
MultilayerGraphs.metadata_tensor โ€” Method
metadata_tensor(mg::M) where {T,U, M <: AbstractMultilayerGraph{T,U}}

Compute the weight tensor of mg. Return an object of type WeightTensor.

source
MultilayerGraphs.SupraWeightMatrix โ€” Type
SupraWeightMatrix{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]
source
MultilayerGraphs.supra_weight_matrix โ€” Method
supra_weight_matrix(mg::M) where {T,U, M <: AbstractMultilayerGraph{T,U}}

Compute the supra weight matrix of mg. Return an object of type SupraWeightMatrix

source

Traits

Utilities

MultilayerGraphs.ฮดk โ€” Type
mutable 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.

source
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 ฮด_ฮฉ.
source

Developer

Nodes

Vertices

MultilayerGraphs.AbstractVertex โ€” Type
abstract 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.

source

Edges

Subgraphs

Graphs.has_vertex โ€” Method
has_vertex( subgraph::S, v::T ) where {T,S<:AbstractSubGraph{T}}

Return true if v is a vertex of subgraph.

source
Graphs.vertices โ€” Method
vertices(subgraph::AbstractSubGraph)

Return the collection of the vertices of subgraph.

source
Graphs.inneighbors โ€” Method
inneighbors(subgraph::S, v::T) where {T, S <: AbstractSubGraph{T}}

Return the list of inneighbors of v within subgraph.

source
Graphs.inneighbors โ€” Method
inneighbors(subgraph::AbstractSubGraph, mv::MultilayerVertex)

Return the list of inneighbors of mv within subgraph.

source
Graphs.outneighbors โ€” Method
outneighbors(subgraph::S, v::T) where {T,S<:AbstractSubGraph{T}}

Return the list of outneighbors of v within subgraph.

source
Graphs.outneighbors โ€” Method
outneighbors(subgraph::AbstractSubGraph, mv::MultilayerVertex)

Return the list of outneighbors of mv within subgraph.

source
Graphs.neighbors โ€” Method
neighbors(subgraph::S, v::T) where {T, S <: AbstractSubGraph{T}}

Return the list of neighbors of v within subgraph.

source
Graphs.neighbors โ€” Method
neighbors(subgraph::AbstractSubGraph, mv::MultilayerVertex)

Return the list of neighbors of mv within subgraph.

source
Graphs.edgetype โ€” Method
edgetype(::S) where {T,U,S<:AbstractSubGraph{T,U}}

Return the edge type for subgraph.

source
edgetype(::M) where {T,U,M<:AbstractMultilayerGraph{T,U}}

Return the edge type for mg.

source
Graphs.has_edge โ€” Method
has_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.

source
Graphs.SimpleGraphs.add_edge! โ€” Method
add_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.

source
MultilayerGraphs.AbstractLayer โ€” Type
AbstractLayer{T,U,G}

An abstract type representing a generic Layer.

FIELDS

  • T: the node type;
  • U: the MultilayerEdge weight eltype;
  • G: the underlying graph type.
source
MultilayerGraphs.Layer โ€” Method
Layer(
    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}}}};
source
MultilayerGraphs.AbstractInterlayer โ€” Type
AbstractInterlayer{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.
source

Multilayer-Specific Methods

Graphs.has_vertex โ€” Method
has_vertex(mg::M, v::T) where {T,M <: AbstractMultilayerGraph{T}}

Return true if v is in mg, else false.

source
Graphs.vertices โ€” Method
vertices(mg::M) where {M<:AbstractMultilayerGraph}

Return the collection of the vertices of mg.

source
Graphs.inneighbors โ€” Method
inneighbors(mg::M, v::T) where {T,M<:AbstractMultilayerUGraph{T,<:Real}}

Return the list of inneighbors of v within mg.

source
Graphs.inneighbors โ€” Method
inneighbors(mg::M, v::T) where {T,M<:AbstractMultilayerGraph; IsDirected{M}}

Return the list of inneighbors of v within mg.

source
Graphs.inneighbors โ€” Method
inneighbors( mg::AbstractMultilayerGraph, mv::MultilayerVertex )

Return the list of inneighbors of mv within mg.

source
Graphs.outneighbors โ€” Method
outneighbors(mg::M, v::T) where {T, M<:AbstractMultilayerGraph{T}}

Return the list of outneighbors of v within mg.

source
Graphs.neighbors โ€” Method
neighbors(mg::AbstractMultilayerGraph, mv::MultilayerVertex)

Get the neighbors of vertex mv in mg. Reduces to outneighbors for both directed and undirected multilayer graphs.

source
Graphs.edgetype โ€” Method
edgetype(::S) where {T,U,S<:AbstractSubGraph{T,U}}

Return the edge type for subgraph.

source
edgetype(::M) where {T,U,M<:AbstractMultilayerGraph{T,U}}

Return the edge type for mg.

source
Graphs.has_edge โ€” Method
has_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).

source
Graphs.has_edge โ€” Method
has_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).

source
Graphs.SimpleGraphs.add_edge! โ€” Method
add_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.

source
Graphs.SimpleGraphs.rem_edge! โ€” Method
rem_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.

source

Representations

MultilayerGraphs.AbstractTensorRepresentation โ€” Type
AbstractTensorRepresentation{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.
source
MultilayerGraphs.AbstractMatrixRepresentation โ€” Type
AbstractMatrixRepresentation{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.
source

Traits

MultilayerGraphs.IsWeighted โ€” Type
IsWeighted{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.

source