shortPath: Shortest path

Description Usage Arguments Details Value Author(s) Examples

View source: R/functions.r

Description

Shortest paths between one vertex and all other vertices.

Usage

1
shortPath(model=NULL,edges=NULL,v=NULL,p=NULL)

Arguments

model

gRapHD object.

edges

matrix with 2 columns, each row representing one edge, and each column one of the vertices in the edge. Column 1 contains the vertex with lower index.

v

vertex.

p

number of vertices. If NULL, the number of vertices will be considered as equal the maximum vertices' index, i.e., p=max(edges).

Details

Calculates the shortest path between the vertex v and all other vertices.

Value

vector

with length equal p, with the shortest path length from v to each other vertex.

Author(s)

Gabriel Coelho Goncalves de Abreu (abreu_ga@yahoo.com.br)
Rodrigo Labouriau (Rodrigo.Labouriau@agrsci.dk)

Examples

1
2
3
data(dsCont)
m1 <- minForest(dsCont,homog=TRUE,forbEdges=NULL,stat="LR")
shortPath(edges=m1@edges,v=1)

Example output

Loading required package: graph
Loading required package: BiocGenerics
Loading required package: parallel

Attaching package: 'BiocGenerics'

The following objects are masked from 'package:parallel':

    clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
    clusterExport, clusterMap, parApply, parCapply, parLapply,
    parLapplyLB, parRapply, parSapply, parSapplyLB

The following objects are masked from 'package:stats':

    IQR, mad, sd, var, xtabs

The following objects are masked from 'package:base':

    Filter, Find, Map, Position, Reduce, anyDuplicated, append,
    as.data.frame, basename, cbind, colMeans, colSums, colnames,
    dirname, do.call, duplicated, eval, evalq, get, grep, grepl,
    intersect, is.unsorted, lapply, lengths, mapply, match, mget,
    order, paste, pmax, pmax.int, pmin, pmin.int, rank, rbind,
    rowMeans, rowSums, rownames, sapply, setdiff, sort, table, tapply,
    union, unique, unsplit, which, which.max, which.min


Attaching package: 'gRapHD'

The following object is masked from 'package:graph':

    DFS

 1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 
 0  5  6  5  8  5  7  8  8  5  1  5  5  7  7  7  4  6  3  9  2  7  4  8  8  6 
27 28 29 30 31 32 33 34 
 3  5  9  9  7  4  9  9 

gRapHD documentation built on Feb. 9, 2018, 6:05 a.m.

Related to shortPath in gRapHD...