create_PU_spp_pair_indices: Convert edge list to PU/spp table

create_PU_spp_pair_indicesR Documentation

Convert edge list to PU/spp table

Description

Converts an edge list to a PU/spp table to give to Marxan and to network functions for bipartite networks:

Usage

create_PU_spp_pair_indices(
  edge_list,
  nodes,
  dependent_node_IDs,
  PU_costs,
  num_PUs
)

Arguments

edge_list

two column integer matrix of node IDs with one row for each edge and columns for the 2 ends of the edge

nodes

data frame containing integer node_ID, integer group_ID, and boolean dependent_set_member

dependent_node_IDs

integer vector of IDs of planning units contained in a constructed correct solution to a Xu problem

PU_costs

numeric vector of planning unit costs

num_PUs

integer number of planning units

Details

Now that we have the edge list, we need to go through and create a table where every link attached to a node appears on a separate line of the table and is labelled with the node ID. So, that means that we have to go through the whole edge list and create 2 new table entries for each link in the edge list. Each of those entries gives the ID of one of the end nodes of the link plus the link's ID.

This table needs to be built because it's the form that Marxan expects the spp and PU data to be in, i.e., node=PU and link=spp and every line in the table is specifying a PU and one of the species in it. If we weren't feeding Marxan, there would be no need for this kind of a table since we already have an edge list.

However, there is one other useful byproduct of building this table. It makes it easy to compute rank-abundance information and information about the distribution of species across patches.

I just realized that this structure is also something like the description of a bipartite network, so I may need to modify or use it in doing the bipartite network analyses too.

Value

Returns a PU_spp_pair_info_class object


langfob/bdpg documentation built on Dec. 8, 2022, 5:33 a.m.