Skip to content
This repository has been archived by the owner on Jun 23, 2023. It is now read-only.

Commit

Permalink
Merge branch 'louvain_mod' of github.com:PoisotLab/EcologicalNetwork.…
Browse files Browse the repository at this point in the history
…jl into louvain_mod
  • Loading branch information
Timothée Poisot committed Mar 29, 2017
2 parents c2f547f + 87a48bb commit a2a1170
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ os:
- linux
julia:
- 0.5
- 0.6
matrix:
allow_failures:
- julia: 0.6
script:
- if [[ -a .git/shallow ]]; then git fetch --unshallow; fi
- julia --check-bounds=yes -e 'Pkg.clone(pwd()); Pkg.build("EcologicalNetwork"); Pkg.test("EcologicalNetwork"; coverage=true)'
Expand Down
25 changes: 25 additions & 0 deletions docs/src/species/foodweb.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,30 @@
# Food-web specific measures

## Measures of trophic level

These measure work by counting the distance to a primary producer -- where
"primary producer" is defined as the fact of not having outgoing interactions.
Primary producers have a trophic level of 1, and species that consume primary
producers have trophic levels of 2, etc. This represents a species' *fractional*
trophic level.

~~~@docs
fractional_trophic_level
~~~

Because some species higher-up the food chain eat preys at various fractional
trophic levels, there is also a more integrative measure -- the trophic level of
a species is the weighted average of the fractional trophic level of its preys:

~~~@docs
trophic_level
~~~

## Measures of trophic positions

For every species in a food web, this will return an array with its overall
position:

~~~@docs
foodweb_position
~~~
6 changes: 6 additions & 0 deletions test/foodwebs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,10 @@ module TestFoodWebs
@test foodweb_position(s1)[2] == :intermediate
@test foodweb_position(s1)[3] == :bottom


# test that the results are the same with and without loops
A = unipartitemotifs()[:S1]
@test foodweb_position(A, loops=false)[1] == :top
@test foodweb_position(A, loops=true)[1] == :top

end
1 change: 0 additions & 1 deletion test/types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ A = BipartiteNetwork([0 1; 0 0])
A = UnipartiteNetwork([0 1; 0 0])
@test typeof(A) <: DeterministicNetwork


# Is there an interaction?
A = UnipartiteNetwork([false true; true false])
@test has_interaction(A, 1, 2)
Expand Down

0 comments on commit a2a1170

Please sign in to comment.