Skip to content

Networks as sets

Abstract

A number of operations can be applied to networks. This include union, intersect, and setdiff. These are useful when workin on network beta-diversity.

Operations

<a id='Base.union-Union{Tuple{T}, Tuple{T, T}} where T<:(SpeciesInteractionNetwork{<:Partiteness, <:Binary})' href='#Base.union-Union{Tuple{T}, Tuple{T, T}} where T<:(SpeciesInteractionNetwork{<:Partiteness, <:Binary})'># Base.unionMethod.

Base.union(U::T, V::T) where {T <: SpeciesInteractionNetwork{<:Partiteness, <:Binary}}

The union of two networks (U ∪ V) is the union of their species and egdes, i.e. everything that is in either networks is present in the union.

source

<a id='Base.intersect-Union{Tuple{T}, Tuple{T, T}} where T<:(SpeciesInteractionNetwork{<:Partiteness, <:Binary})' href='#Base.intersect-Union{Tuple{T}, Tuple{T, T}} where T<:(SpeciesInteractionNetwork{<:Partiteness, <:Binary})'># Base.intersectMethod.

Base.intersect(U::T, V::T) where {T <: SpeciesInteractionNetwork{<:Partiteness, <:Binary}}

The intersect of two networks (U ∩ V) is the network composed of species in both networks, and the interactions present in both networks as well. Note that species that have no interaction in common between the two networks will still be in the resulting network, but with no interactions.

source

<a id='Base.setdiff-Union{Tuple{T}, Tuple{T, T}} where T<:(SpeciesInteractionNetwork{<:Partiteness, <:Binary})' href='#Base.setdiff-Union{Tuple{T}, Tuple{T, T}} where T<:(SpeciesInteractionNetwork{<:Partiteness, <:Binary})'># Base.setdiffMethod.

Base.setdiff(U::T, V::T) where {T <: SpeciesInteractionNetwork{<:Partiteness, <:Binary}}

The setdiff between two networks is the species and interactions that are unique to the first argument. Note that the operation is not commutative, i.e. setdiff(U,V)≠setdiff(V,U).

source