Paths and centrality

Number of paths and shortest path

EcologicalNetworks.shortest_pathFunction
shortest_path(N::UnipartiteNetwork; nmax::Int64=50)

This is not an optimal algorithm at all, but it will do given that most ecological networks are relatively small. The optional nmax argument is the longest shortest path length you will look for.

In ecological networks, the longest shortest path tends not to be very long, so any value above 10 is probably overdoing it. Note that the default value is 50, which is above 10.

source
shortest_path(N::UnipartiteQuantiNetwork; nmax::Int64=50)

This function will remove quantitative information, then measure the shortest path length.

source
EcologicalNetworks.bellman_fordFunction
bellman_ford(N::T, source::K) where {T <: DeterministicNetwork, K}

Bellman-Ford algorithm to return the shortest / easiest paths from a source species. Refer to the bellman_ford global documentation for the output format.

source
bellman_ford(N::T) where {T <: DeterministicNetwork}

Bellman-ford algorithm to return the shortest / easiest paths between all pairs of species in the networks, as long as paths exists. This function will return a tuple, with fields from, to and weight. The number of elements in the tuple is the number of paths. This function works with quantitative and binary networks, and assumes that no interactions are negative.

Currently, the Bellman-Ford algorithm is slower than the shortest_path function, but the arguments are returned in a more usable way. Note that the speed penalty is only valid when measuring the shortest paths in the entire network (and will be fixed relatively soon), and does not apply as much for the shortest paths from a single source node.

source
EcologicalNetworks.dijkstraFunction
dijkstra(N::T) where {T <: DeterministicNetwork}

Dijkstra algorithm to return the shortest / easiest paths between all pairs of species in the networks, as long as paths exists. This function will return a tuple, with fields from, to and weight. The number of elements in the tuple is the number of paths. This function works with quantitative and binary networks, and assumes that no interactions are negative.

source
dijkstra(N::T, source::K) where {T <: DeterministicNetwork, K}

Dijkstra's algorithm to return the shortest / easiest paths from a source species. Refer to the bellman_ford global documentation for the output format.

source

Centrality measures

EcologicalNetworks.centrality_closenessFunction
centrality_closeness(N::UnipartiteNetwork; nmax::Int64=20)

The function calls shortest_path internally – the nmax argument is the maximal path length that will be tried.

References

  • Bavelas, A., 1950. Communication Patterns in Task‐Oriented Groups. The Journal of the Acoustical Society of America 22, 725–730. doi:10.1121/1.1906679
source
EcologicalNetworks.centrality_katzFunction
centrality_katz(N::Unipartite; a::Float64=0.1, k::Int64=5)

This measure can work on different path length (k), and give a different weight to every subsequent connection (a). k must be at least 1 (only immediate neighbors are considered). a (being a weight), must be positive.

Katz, L., 1953. A new status index derived from sociometric analysis. Psychometrika 18, 39–43. doi:10.1007/bf02289026

source
EcologicalNetworks.centrality_harmonicFunction
centrality_harmonic(N::UnipartiteNetwork; nmax::Int64=20)

The function calls shortest_path internally – the nmax argument is the maximal path length that will be tried.

source