Networks are following the AbstractArray
interface rather closely, with some additional functionalities to get at interactions by using species names rather than networks positions.
Accessing elements
Base.getindex
— Functiongetindex(N::AbstractEcologicalNetwork, i::T, j::T)
Get the value of an interaction based on the position of the species.
getindex(N::AbstractEcologicalNetwork, i::T)
Get the value of an interaction based on the position of the species.
getindex(N::AbstractEcologicalNetwork, ::Colon, j::T)
Get the value of an interaction based on the position of the species.
getindex(N::AbstractEcologicalNetwork, i::T, ::Colon)
Get the value of an interaction based on the position of the species.
getindex{T}(N::AbstractEcologicalNetwork, s1::T, s2::T)
Get the value of an interaction based on the name of the species. This is the recommended way to look for things in a network.
getindex{T}(N::AbstractBipartiteNetwork, ::Colon, sp::T)
Gets the predecessors (i.e. species that interacts with / consume) of a focal species. This returns the list of species as a Set
object, in which ordering is unimportant.
getindex{T}(N::AbstractEcologicalNetwork, sp::T, ::Colon)
Gets the successors (i.e. species that are interacted with / consumed) of a focal species. This returns the list of species as a Set
object, in which ordering is unimportant.
getindex{T}(N::AbstractUnipartiteNetwork, sp::Array{T})
Induce a unipartite network based on a list of species, all of which must be in the original network. This function takes a single argument (as opposed to two arrays, or an array and a colon) to ensure that the returned network is unipartite.
The network which is returned by this function may not have the species in the order specified by the user for performance reasons.
getindex{T}(N::AbstractBipartiteNetwork, ::Colon, sp::Array{T})
TODO
getindex{T}(N::AbstractBipartiteNetwork, sp::Array{T}, ::Colon)
TODO
getindex{T}(N::AbstractBipartiteNetwork, sp1::Array{T}, sp2::Array{T})
TODO
getindex{T}(N::AbstractBipartiteNetwork, sp1::Array{T}, sp2::Array{T})
TODO
Changing elements
The ecological networks types are all mutable.
Base.setindex!
— Functionsetindex!(N::T, A::Any, i::E, j::E) where {T <: AbstractEcologicalNetwork, E}
Changes the value of the interaction at the specificied position, where i
and j
are species names. Note that this operation changes the network.
setindex!(N::T, A::K, i::E, j::E) where {T <: AbstractEcologicalNetwork, K <: _interaction_type(N), E <: Int}
Changes the value of the interaction at the specificied position, where i
and j
are species positions. Note that this operation changes the network.
Network size
Base.size
— Functionsize(N::AbstractEcologicalNetwork)
Return the size of the adjacency matrix of an AbstractEcologicalNetwork
object.
size(N::AbstractEcologicalNetwork, i::Int64)
Return the size of the adjacency matrix of an AbstractEcologicalNetwork
object.