Return a simplified segment graph for a neuron

segmentgraph(x, weights = TRUE, segids = FALSE,
  exclude.isolated = FALSE, include.xyz = FALSE,
  reverse.edges = FALSE)

Arguments

x

neuron

weights

Whether to include the original segment lengths as edge weights in the graph.

segids

Whether to include the integer segment ids as an edge attribute in the graph

exclude.isolated

Whether to eliminate isolated nodes

include.xyz

Whether to include 3D location as vertex attribute

reverse.edges

Whether to reverse the direction of each edge in the output graph to point towards (rather than away from) the root (default FALSE)

Value

igraph object containing only nodes of neuron keeping original labels (x$d$PointNo => V(g)$label) and vertex indices (1:nrow(x$d) => V(g)$vid).

Details

The resultant graph will contain all branch and endpoints of the original neuron. This will be constructed from the SegList field, or where present, the SubTrees field (containing multiple SegLists for each isolated graph in the neuron). Each edge in the output graph will match one segment in the original SegList.

Examples

sg=segmentgraph(Cell07PNs[[1]]) str(sg)
#> List of 10 #> $ :List of 1 #> ..$ : 'igraph.vs' int 2 #> .. ..- attr(*, "env")=<weakref> #> .. ..- attr(*, "graph")= chr "dad159fb-1e80-4e05-a99c-c3977965276e" #> $ :List of 1 #> ..$ : 'igraph.vs' int [1:2] 3 4 #> .. ..- attr(*, "env")=<weakref> #> .. ..- attr(*, "graph")= chr "dad159fb-1e80-4e05-a99c-c3977965276e" #> $ :List of 1 #> ..$ : 'igraph.vs' int(0) #> .. ..- attr(*, "env")=<weakref> #> .. ..- attr(*, "graph")= chr "dad159fb-1e80-4e05-a99c-c3977965276e" #> $ :List of 1 #> ..$ : 'igraph.vs' int [1:2] 5 8 #> .. ..- attr(*, "env")=<weakref> #> .. ..- attr(*, "graph")= chr "dad159fb-1e80-4e05-a99c-c3977965276e" #> $ :List of 1 #> ..$ : 'igraph.vs' int [1:2] 6 7 #> .. ..- attr(*, "env")=<weakref> #> .. ..- attr(*, "graph")= chr "dad159fb-1e80-4e05-a99c-c3977965276e" #> $ :List of 1 #> ..$ : 'igraph.vs' int(0) #> .. ..- attr(*, "env")=<weakref> #> .. ..- attr(*, "graph")= chr "dad159fb-1e80-4e05-a99c-c3977965276e" #> $ :List of 1 #> ..$ : 'igraph.vs' int(0) #> .. ..- attr(*, "env")=<weakref> #> .. ..- attr(*, "graph")= chr "dad159fb-1e80-4e05-a99c-c3977965276e" #> $ :List of 1 #> ..$ : 'igraph.vs' int [1:2] 9 12 #> .. ..- attr(*, "env")=<weakref> #> .. ..- attr(*, "graph")= chr "dad159fb-1e80-4e05-a99c-c3977965276e" #> $ :List of 1 #> ..$ : 'igraph.vs' int [1:2] 10 11 #> .. ..- attr(*, "env")=<weakref> #> .. ..- attr(*, "graph")= chr "dad159fb-1e80-4e05-a99c-c3977965276e" #> $ :List of 1 #> ..$ : 'igraph.vs' int(0) #> .. ..- attr(*, "env")=<weakref> #> .. ..- attr(*, "graph")= chr "dad159fb-1e80-4e05-a99c-c3977965276e" #> - attr(*, "class")= chr "igraph"
library(igraph) plot(sg, edge.arrow.size=.4, vertex.size=10)