defaultNodeOrder: Default layout function for BioFabric

Description Usage Arguments Details Value Author(s) Examples

View source: R/bioFabric.R

Description

Does breadth-first layout of a network for BioFabric

Usage

1
  defaultNodeOrder(bfGraph, firstLabel = NULL)

Arguments

inGraph

The graph to order, in igraph format (see igraph). Node names MUST already be set using the vertex attribute "name".

firstLabel

(optional) The label of the node to start at.

Details

Default node layout based on breadth-first search from highest degree node, searching in order of decreasing degree. Takes a network provided in igraph format (see igraph) and returns the same network, with the nodes reordered to the default breadth-first layout order

Value

The provided graph with the nodes reordered per the BioFabric default layout algorithm.

Author(s)

Bill Longabaugh <wlongabaugh@systemsbiology.org>

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
## Not run: 
# Gotta have igraph!

library(igraph)

# defaultNodeOrder requires we name the graph, so we
# do that first. Typically, there is no reason to provide
# this function to bioFabric, since it uses it internally.
# However, we can gain extra functionality by providing the
# firstLabel argument, which starts the search at the specified
# node instead od the highest degree node. So wrapping the
# defaultNodeOrder as shown allows us to start at the top of
# the given tree (degree = 2), which is lower degree than
# its child nodes.

bfGraph = graph.tree(20, children=2, mode="out")
bfGraph <- autoNameForFabric(bfGraph)
startAtBF1 <- function(bfGraph) {
  return (defaultNodeOrder(bfGraph, firstLabel=V(bfGraph)[1]$name))
}
bioFabric(bfGraph, orderFunc=startAtBF1)

## End(Not run)

wjrl/RBioFabric documentation built on May 4, 2019, 7:34 a.m.