diff --git a/Project.toml b/Project.toml index f8bd0ac..ffe8273 100644 --- a/Project.toml +++ b/Project.toml @@ -23,7 +23,7 @@ TensorOperations = "6aa20fa7-93e2-5fca-9bc0-fbd0db3c71a2" WhereTraits = "c9d4e05b-6318-49cb-9b56-e0e2b0ceadd8" [compat] -Bijections = "0.1" +Bijections = "0.2" DataStructures = "0.18, 0.19" Distributions = "0.25" Graphs = "1" diff --git a/src/abstractmultilayergraph.jl b/src/abstractmultilayergraph.jl index 6e3e315..be9b9d7 100644 --- a/src/abstractmultilayergraph.jl +++ b/src/abstractmultilayergraph.jl @@ -51,7 +51,7 @@ fadjlist(mg::AbstractMultilayerGraph) = mg.fadjlist Return the nodes of the AbstractMultilayerGraph `mg`, in order of addition. """ function nodes(mg::AbstractMultilayerGraph) - return [couple[2] for couple in sort(collect(mg.idx_N_associations); by=first)] + return Node[node for (_, node) in sort!(collect(mg.idx_N_associations); by=first)] end """ diff --git a/src/multilayerdigraph.jl b/src/multilayerdigraph.jl index 4f93bfe..ff31f14 100644 --- a/src/multilayerdigraph.jl +++ b/src/multilayerdigraph.jl @@ -7,7 +7,7 @@ mutable struct MultilayerDiGraph{T,U} <: AbstractMultilayerGraph{T,U} layers::Vector{LayerDescriptor{T,U}} # vector containing all the layers of the multilayer graph. Their underlying graphs must be all undirected. interlayers::OrderedDict{Set{Symbol},InterlayerDescriptor{T,U}} # the ordered dictionary containing all the interlayers of the multilayer graph. Their underlying graphs must be all undirected. v_V_associations::Bijection{T,<:MultilayerVertex} # A Bijection from Bijections.jl that associates numeric vertices to `MultilayerVertex`s. - idx_N_associations::Bijection{Int64,Node} # A Bijection from Bijections.jl that associates Int64 to `Node`s. + idx_N_associations::Bijection{Int64,Node,Dict{Int64,Node},Dict{Node,Int64}} # A Bijection from Bijections.jl that associates Int64 to `Node`s. fadjlist::Vector{Vector{HalfEdge{<:MultilayerVertex,<:Union{Nothing,U}}}} # the forward adjacency list of the MultilayerDiGraph. It is a vector of vectors of `HalfEdge`s. Its i-th element are the `HalfEdge`s that originate from `v_V_associations[i]`. badjlist::Vector{Vector{HalfEdge{<:MultilayerVertex,<:Union{Nothing,U}}}} # the backward adjacency list of the MultilayerDiGraph. It is a vector of vectors of `HalfEdge`s. Its i-th element are the `HalfEdge`s that insist on `v_V_associations[i]`. v_metadata_dict::Dict{T,<:Union{<:Tuple,<:NamedTuple}} # A Dictionary that associates numeric vertices to their metadata diff --git a/src/multilayergraph.jl b/src/multilayergraph.jl index 4b21deb..4eab5e0 100644 --- a/src/multilayergraph.jl +++ b/src/multilayergraph.jl @@ -7,7 +7,7 @@ mutable struct MultilayerGraph{T,U} <: AbstractMultilayerGraph{T,U} layers::Vector{LayerDescriptor{T,U}} # vector containing all the layers of the multilayer graph. Their underlying graphs must be all undirected. interlayers::OrderedDict{Set{Symbol},InterlayerDescriptor{T,U}} # the ordered dictionary containing all the interlayers of the multilayer graph. Their underlying graphs must be all undirected. v_V_associations::Bijection{T,<:MultilayerVertex} # A Bijection from Bijections.jl that associates numeric vertices to `MultilayerVertex`s. - idx_N_associations::Bijection{Int64,Node} # A Bijection from Bijections.jl that associates Int64 to `Node`s. + idx_N_associations::Bijection{Int64,Node,Dict{Int64,Node},Dict{Node,Int64}} # A Bijection from Bijections.jl that associates Int64 to `Node`s. fadjlist::Vector{Vector{HalfEdge{<:MultilayerVertex,<:Union{Nothing,U}}}} # the forward adjacency list of the MultilayerGraph. It is a vector of vectors of `HalfEdge`s. Its i-th element are the `HalfEdge`s that originate from `v_V_associations[i]`. v_metadata_dict::Dict{T,<:Union{<:Tuple,<:NamedTuple}} # A Dictionary that associates numeric vertices to their metadata. end