seglist makes a seglist object from a list of integer vectors of raw vertex ids. As a convenience if a vector of numeric ids are passed these are assumed to specify a neuron with 1 segment.

as.seglist.neuron will extract the seglist from a neuron, optionally extracting all subtrees (all=TRUE) and (in this case) flattening the list into a single hierarchy when flatten=TRUE. n.b. when all=TRUE but flatten=FALSE the result will always be a list of seglist objects (even if the neuron has only one subtree i.e. is fully connected).

as.seglist.igraph will convert a fully connected acyclic ngraph or igraph object into a seglist consisting of exactly one subtree.

seglist(...)

as.seglist(x, ...)

# S3 method for neuron
as.seglist(x, all = FALSE, flatten = FALSE, ...)

# S3 method for igraph
as.seglist(x, origin = NULL, Verbose = FALSE, ...)

Arguments

...

for seglist integer vectors to convert to a seglist

x

object passed to be converted to seglist

all

Whether to include segments from all subtrees

flatten

When all=TRUE flatten the lists of lists into a one-level list.

origin

The origin of the tree (see details)

Verbose

Whether to print progress updates to console (default FALSE)

Value

A list with additional class seglist. a list with one entry for each unbranched segment.

Details

see neuron for further information about seglists.

If the graph vertices have vid attributes, typically defining the original vertex ids of a graph that was then decomposed into subgraphs, then the origin is assumed to refer to one of these vids not a raw vertex id of the current graph. The returned seglist will also contain these original vertex ids.

The head of the first segment in the seglist will be the origin.

See also

Examples

sl=seglist(c(1:2),c(2:6))