Learn R Programming

gRapHD (version 0.2.5)

shortPath: Shortest path

Description

Shortest paths between one vertex and all other vertices.

Usage

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).

Value

vector

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

Details

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

Examples

Run this code
# NOT RUN {
data(dsCont)
m1 <- minForest(dsCont,homog=TRUE,forbEdges=NULL,stat="LR")
shortPath(edges=m1@edges,v=1)
# }

Run the code above in your browser using DataLab