Conversions between types are used to perform two usual operations: make a bipartite network unipartite, and remove quantitative information. There are two high-level functions which work by using the union types, and a series of type-to-type functions (the later should be avoided, and exists only to make the high-level functions work).

Base.convertFunction
convert(::Type{UnipartiteNetwork}, N::T) where {T <: BipartiteNetwork}

Projects a deterministic bipartite network in its unipartite representation.

source
convert(::Type{UnipartiteProbabilisticNetwork}, N::T) where {T <: BipartiteProbabilisticNetwork}

Projects a probabilistic bipartite network in its unipartite representation.

source
convert(::Type{UnipartiteQuantitativeNetwork}, N::T) where {T <: BipartiteQuantitativeNetwork}

Projects a quantitative bipartite network in its unipartite representation.

source
convert(::Type{UnipartiteNetwork}, N::T) where {T <: UnipartiteQuantitativeNetwork}

Convert a unipartite quantitative network to a unipartite binary network. This amounts to removing the quantitative information.

source
convert(::Type{BipartiteNetwork}, N::T) where {T <: BipartiteQuantitativeNetwork}

Convert a bipartite quantitative network to a bipartite binary network. This amounts to removing the quantitative information.

source
convert(::Type{AbstractUnipartiteNetwork}, N::AbstractBipartiteNetwork)

Projects any bipartite network in its unipartite representation. This function will call the correct type-to-type convert function depending on the type of the input network.

The type to be converted to must be AbstractUnipartiteNetwork – for example, converting a bipartite probabilistic network to a probabilistic unipartite network is not a meaningful operation.

source
convert(::Type{BinaryNetwork}, N::QuantitativeNetwork)

Projects any bipartite network in its unipartite representation. This function will call the correct type-to-type convert function depending on the type of the input network.

This function does not work for probabilistic networks. The operation of generating a deterministic network from a probabilistic one is different from a simple conversion: it can be done either through random draws, or by selecting only interactions with a probability greater than 0 (N>0.0 will do this).

source
convert(::Type{BipartiteNetwork}, N::T) where {T <: UnipartiteNetwork}

Projects a unipartite network (specifically, a BipartiteNetwork) to its bipartite representation. The following checks are performed.

First, the network cannot be degenerate, since species with no interactions cannot be assigned to a specific level. Second, the species cannot have both in and out degree. If these conditions are met, the bipartite network will be returned.

source
convert(::Type{BipartiteProbabilisticNetwork}, N::T) where {T <: UnipartiteProbabilisticNetwork}

Projects a unipartite network (specifically, a BipartiteProbabilisticNetwork) to its bipartite representation. The following checks are performed.

First, the network cannot be degenerate, since species with no interactions cannot be assigned to a specific level. Second, the species cannot have both in and out degree. If these conditions are met, the bipartite network will be returned.

source
convert(::Type{BipartiteQuantitativeNetwork}, N::T) where {T <: UnipartiteQuantitativeNetwork}

Projects a unipartite network (specifically, a BipartiteQuantitativeNetwork) to its bipartite representation. The following checks are performed.

First, the network cannot be degenerate, since species with no interactions cannot be assigned to a specific level. Second, the species cannot have both in and out degree. If these conditions are met, the bipartite network will be returned.

source