Social Networks and Ecological Food Webs

I read an interesting recent article that discussed a digital “autopsy” of the social network Friendster. Friendster was the grandfather of the social network, preceding both MySpace and Facebook. At its peak it had over 100 million users and a $30 million buyout offer from Google (which they turned down). However, following some technical problems and a site redesign in 2009, the network suffered a catastrophic loss of traffic as users moved to other networks like Facebook.

In this “autopsy” the authors looked into the reasons behind Friendsters “death” and discussed two general reasons for the failure:

  1. The first factor is a cost-benefit ratio: when the costs, in terms of time and effort exerted by being a member of the social network are greater than the benefits obtained, the conditions are set for users to leave.
  2. This is where the network’s topology is important. If a huge number of people in the network have only two friends, then when one of them leaves, the other is left alone on the network and will likely exit as well. This results in a cascade of users leaving the network. However, if people have many friends on the network (many connections), the loss of a single friend is unlikely to result in their exit from the network and unlikely to trigger a cascade of exiting users.

The authors concluded that the “cause of death” was due to declining cost-benefit ratios experienced by users as a result of the technical problems and site redesign. However, it was exacerbated by the network structure.

So, the key point here is that the resilience of the network is determined by the number of connections that each person in the network has. So for any given network, the proportion of the network containing a certain number of friends fraction of the network with a certain number of friends with few connections can be a crucial indicator of the network’s overall resilience from cascades.

In ecology, food webs are “networks” that describe a biological community in terms of the interactions between consumers and resources. The interactions are modeled as connections between consumers and resources that relate to the represent the transfer of energy and matter between the two. The interactions are diagrammed as lines connecting the consumers and their resources – which could be predators and prey, herbivores and plants, plants and soil, etc.

What’s interesting about the Friendster article is its very strong parallel to ecological systems like food webs. Both social networks and food webs need many connections for stability and resilience. Like Friendster, food webs with few participants are highly vulnerable to collapse or sudden radical changes in their structure (called a “trophic cascade“), in which the loss or addition of one or more key participants effectively changes the entire food web by altering key links between network participants. (For example, it’s impossible to play the Kevin Bacon game if he were not part of the network).

For social networks, the key to stability is each person having many Friends so that the loss of any single friend from the network is buffered by the many connections that each person has with other friends. For food webs, stability comes from a similar structure: they need many participants in the food web (the network) to create many different pathways between resources. Having many participants requires preserving biodiversity. If the biodiversity of a system is altered too much by the loss of a top predator or the introduction of an invasive species, the “network” can change. When this happens, vital connections between species can be broken and other connections can arise when newly introduced species competes for the same resources that were formerly linked only to native species. If the network does not contain many participants and has few connections, even small changes in the network will have drastic effects – in the worst case, it can result in a trophic cascade, such as the one that “killed” Friendster.

 

Featured image from: http://coralreef.noaa.gov/education/educators/resourcecd/posters/images/iyor_foodweb.jpg

A Maxent Script Tool for ArcGIS

As part of my PhD research at the University of Arizona where I study biogeography, biodiversity and macroecology, I have been part of a group looking at large-scale biodiversity questions for New World plants. In this role, I have been responsible for generating many species distribution models using Stephen Phillip’s Maxent software (and R with the Dismo package). I also use ArcGIS quite often to prepare environmental data for Maxent modeling, and wanted a way to perform and integrate Maxent modeling into my ArcGIS workflows.

Maxent Tool User InterfaceWhen working with data and analysis, my rule is that if I have to do something complicated more than twice, it’s generally worth it to develop an automated workflow. So for my species distribution modeling needs, I wanted a Maxent script tool that I could use as a standalone geoprocessing tool or embed within a ModelBuilder model for use more complicated workflows. For example, one of my most common workflow is iterating through a list of species and running a species distribution model for each one.

To accomplish this, I wrote an ArcGIS script tool in Python that collects a variety of common Maxent parameters in a typical ArcGIS geoprocessing user interface and populates a command string to execute Stephen Phillip’s maxent.jar Java application via a Python call to execute a system command. The resulting script tool uses the arcpy model, so it works like any other ArcGIS geoprocessing script tool. It can operate as a standalone tool to generate a species distribution model for a single species, or can be placed into a ModelBuilder workflow and linked to input parameters as shown in the example below.

Maxent Tool in a ModelBuilder Model

In this example, the script tool is parameterized with a species occurrence dataset obtained from the iterator object in which each dataset is named genus_species.csv. The tool then generates a species distribution model for each species and saves the model to a separate directory within a designated output directory, naming each directory by the genus and species name specified in the name of the input occurrence dataset.

A partial example of the Python script that obtains the parameters from the input datasets is shown below.

Maxent Tool Python Script

These parameters are then appended to a string object that is a system command call:

myCommand = "java -mx512m -jar \"" + maxent + "\" -e \"" + climatedataFolder + "\""
myCommand += " -s \"" + csvFile + "\" -o \"" + newOutputFolder + "\""
myCommand += " outputformat=" + optOutputFormat.lower() + " outputfiletype=" + optOutputFileType.lower()

Finally the command is executed via a call to the os.system Python interface that executes the maxent.jar Javascript application with the appropriate options:

result = os.system(myCommand)

When the maxent.jar Java application launches, you’ll see the typical Maxent GUI that you would see if you launched maxent.jar directly and ran a model manually. Except in this case the maxent.jar application launches and starts the model automatically, as shown below.:
Maxent Running

Of course there are some additional script lines that are not shown in the examples above add other maxent parameters to the command string and evaluate the result of the os.system call to determine whether the command executed correctly or not.

However, I have placed a copy of a simple ArcGIS Toolbox and the associated Python script in a zipfile that you can download for your own modeling uses at the link below. There are different versions for each version of ArcGIS you may be using. While newer versions of ArcGIS can read older toolboxes, older versions of ArcGIS cannot read newer toolboxes. So be sure to download the file below that is most appropriate for your ArcGIS version.

Maxent Tool in ArcCatalogIf you like the tool, please let me know if you have any questions or comments/ideas. This is a fairly simple first implementation that I built to get through a lot of modeling quickly. However, I have a few ideas for additions to the tool that would enable it to handle species occurrence point data directly (instead of using saved CSVs) and perhaps leverage Maxent cache (.mxe) files instead of using the environmental data ASC files for each model iteration. At the moment, I’m too busy to add these, but it may be something I add in the future to round out the tool better.

Speedy Attribute Editing with a Custom ArcMap Add-In

One of my colleagues, TerraSystems Southwest, is assisting The Nature Conservancy in Tucson with the Sonoran Desert Disturbed Lands Analysis project. As part of their scope of work, they were asked to assess the level and type of land disturbance for over 100,000 1-square mile hexagons covering the Sonoran Desert.

As you might expect, editing the attributes of 100,000+ polygons is not a trivial task, and TerraSystems approached me to help find a way to make their editing task faster. The solution we came up with was a custom ArcMap add-in that would enable them to quickly edit the attributes for a selected polygon and move to the next feature for assessment.

The ArcGIS 10.0 and 10.1 add-in was developed in Visual Studio 2010 using esri ArcObjects, and contains a custom toolbar, tools, buttons, and dockable window forms. The Add-in leverages the ArcGIS add-in framework for simple deployment and updating.

TNC Custom Add-in Toolbar

The Add-in quickly edits the attributes of customizable fields to record the following information about each hexagon:

  • The disturbance amount (i.e. DistAmnt) of type Double
  • The disturbance type (i.e. DistType) of type String at least 2 characters wide. (The editor records an abbreviation of the disturbance type)
  • The order (priority) in which you want to edit the polygons (i.e. HexID), of type Integer
  • A flag (i.e. DistFlag) indicating that a polygon needs further review, of type Integer (stores a null, 0 or 1)

The Add-in allows users to identify the layer and fields in which to record these attributes, so it is not hard-coded to a particular layer or field name. In addition, the Add-in records the layer and field assignments to an XML file for reloading in future editing sessions, so users only need to configure the Add-in once.

TNC Custom Add-in Screen

Moreover, it was important to also ensure that the disturbance level and type attributes were not hard-coded, as it may be advantageous to add additional disturbance types in the future. In response, the Add-in was written to load both the disturbance levels and types from XML files that can be easily accessed from within the Add-in to make changes to the attributes the Add-in records for each feature.

XML Screenshot

The main strength of this Add-in is time savings during editing, users can select a feature and quickly edit multiple attributes using two different editing methods:

  • The Add-in dynamically* maps keys on their keyboard to enable power users to press a number key to set the feature’s level of disturbance, followed by a letter key to set the feature’s type of disturbance. Users can also press the space-bar to flag a feature as needing follow-up.
  • Alternatively, users can open the dockable Quick Edit window that contains dynamically* added buttons that represent disturbance levels and disturbance types. Users simply click one disturbance level button and another disturbance type button to set the feature’s attributes. Alternatively, users can click a button to flag the feature for follow-up.

TNC Custom Add-in Screen 2

* The buttons and keys are dynamically mapped when the Add-in loads. So if users edit the XML files to register new disturbance levels and types, the Add-in will dynamically map a new key and add new buttons to the QuickEdit Window.

Once both the feature’s disturbance level and type have been set (either by pressing custom mapped keys or using the Quick Edit Window), the Add-in will automatically* select the next feature in the edit series (using the field users selected as their Priority field when they configured the Add-in) and automatically* zoom to the next feature for inspection.

* Some times there are editing situations in which users prefer to not have the Add-in automatically select the next feature and/or zoom to the next feature. So both of these functions can be turned on or off in the Add-in’s configuration window.

Finally the Add-in contains help documentation showing users how to install, use and customize the Add-in.

TNC Custom Add-in Screen 3

By a conservative estimate, this Add-in shaves approximately 7 seconds off of each editing operation. Multiplied by the 100,000+ hexagons, the Add-in has saved nearly 200 hours on this project and countless hours on future projects that can leverage its customizable framework for future conservation assessment programs.

For more information about the Add-in see our website:

http://www.johndonoghue.net/gis/selected-projects/tnc-land-disturbance-editor-arcmap-custom-add-in/

Creating a Video of Vegetative Cover Sampling

As part of my graduate obligations for a course in methods of measuring and monitoring plant populations, I had to do some type of course project. Though our instructor offered several options of varying difficulty, it was clear that he really wanted someone to attempt to produce a video outlining how to do a method.

As I had done a couple of videos for other projects in the past, I was fairly certain that this would be the most difficult of the graduate project options, but after exploring my other project options, I decided to attempt the video.

So over the last few days I’ve been writing a script, planning shots, doing on-site filming, editing, and voiceover work. Then more on-site filming, more editing and more voiceover work. After several hours of dedicated editing time, I’ve finished the video.

I think it’s pretty good. It’s not great, but it’s got potential. The main challenges were equipment related. It was windy on both filming days and I don’t have fancy microphones, so we had wind noise in some of the live action clips. Despite that I was using an HD video camera that I won at a conference, the video quality wasn’t as good as I’d expected, but it was the best method of filming the video with what we had available.

Anyway, the end-result is an 8 minute video that demonstrates how to sample vegetative cover using the point-intercept method. I briefly walk viewers through what cover is, why it’s commonly measured, and how to establish random sampling locations. Then I illustrate how to lay out a transect and how to sample points using a drop rod. I discuss how to record the data and finish with a demonstration of how the recorded data can be summarized in Excel. (There’s a mistake in that section, that I caught very late in my editing and didn’t want to tackle fixing as it would have required a new voiceover that took me four takes to do the first time. See if you can spot it).

If you’re curious you can find the video on You Tube at: http://youtu.be/NhcNjikpApg

Feel free to provide comments – as long as they’re positive 😉

A Species Diversity Map for 88,000 New World Species

This is a small sample of a species diversity map that’s an end product of our models. This was created by overlaying 88,000+ shapefiles and represents the number of species potentially present in each cell. Red is low, dark blue and purple are high (over 8,000 species per cell).