tool.subgraph.search {Mergeomics} | R Documentation

## Search neighborhoods for given nodes

### Description

`tool.subgraph.search` looks for both upstream and downstream neighborhoods of given seed node list for a given depth, gets the directed edge information among seed nodes and their neighbors, obtains statistics (degrees and strengths) for seed nodes.

### Usage

    tool.subgraph.search(graph, seeds, depth, direction)

### Arguments

`graph` | a datalist including following components:
    nodes: N-element array of node names
    tails: K-element array of node indices
    heads: K-element array of node indices
    weights:  K-element array of edge weights
    tail2edge: N-element list of adjacent edge indices
    head2edge: N-element list of adjacent edge indices
    outstats: N-row data frame of out-degree node statistics
    instats: N-row data frame of in-degree node statistics
    stats: N-row data frame of node statistics
`seeds` | seed nodes' indices
`depth` | the maximum number of links to connect neighbors
`direction` | sets the directionality: use a negative value for dowstream, positive for upstream or zero for undirected

### Value

a data list including seed nodes neighborhood information with following components:

`RANK` | indices of neighboring nodes (including seeds)
`LEVEL` | number of edges away from seed
`STRENG` | sum of adjacent edge weights within neighborhood
`DEGREE` | number of adjacent edges within neighborhood

### Author(s)

Ville-Petteri Makinen

### Examples

    data(job_kda_analyze)
    depth <- 1
    direction <- 0
    ## Take one or multiple center nodes (seeds) to search the neighborhoods:
    ## e.g. take the first node in the graph as the seed, find its neighborhood:
    center.node = job.kda$graph$nodes[1]
    ## Convert center node (seed) names to indices:
    nodes <- job.kda$graph$nodes
    ranks <- match(center.node, nodes)
    ranks <- ranks[which(ranks > 0)]
    ## we already know that rank is 1, since we took the first node in the graph
    ## as an example:
    ranks <- as.integer(ranks)
    ## Find neighbors.
    res <- tool.subgraph.search(job.kda$graph, ranks, depth, direction)

[Package Mergeomics version 1.18.0 Index]