Compute the distances between pairs of vertices in a graph, using a shortest path, diffusion kernel, or mean firstpassage timebased measure.
1 2 
g 

v 

edge.attr 
String, the name of the edge attribute to be used as distances along the edges. If 
dist.method 
String, the method used to compute the distance between each vertex pair. 
correct.inf 
Logical, if 
correct.factor 
Numeric value, if the graph contains unconnected vertices, then the distance between these vertices is set as the maximum distance between the connected vertices multiplied by 
verbose 
Logical, if 
This function computes a distance matrix for a graph. Different methods can be used to calculate the distance between each pair of vertices. If a set of vertices is specified, a smaller distance matrix containing only vertices corresponding to the vertices is returned.
Descriptions of how the shortest paths (shortest.paths
), diffusion kernelbased (GraphDiffusion
) and mean firstpassage time (GraphMFPT
) distance measures work are given in their respective function descriptions.
Numeric matrix, containing the distances between vertex pairs.
Alex J. Cornish a.cornish12@imperial.ac.uk
Kondor, R.I. and Lafferty, J. (2002). Diffusion Kernels on Graph and Other Discrete Structures. Proc. Intl. Conf. Machine Learning.
White, S. and Smyth, P. (2003). Algorithms for Estimating Relative Importance in Networks. Technical Report UCIICS 0425.
shortest.paths
,
GraphDiffusion
,
GraphMFPT
1 2 3 4 5 6 7 8 9 10 11  # create a graph and compute the distance matrix using the shortest paths measure
g1 < barabasi.game(6, directed=FALSE)
DistGraph(g1, dist.method="shortest.paths")
plot(g1, layout=layout.fruchterman.reingold)
# create a graph, assign edge distances and compute the distance matrix using the
# diffusion kernelbased measure
g2 < erdos.renyi.game(6, p.or.m=0.5, directed=FALSE)
g2 < set.edge.attribute(g2, name="distance", value=runif(ecount(g2)))
DistGraph(g2, dist.method="diffusion", edge.attr="distance")
plot(g2, layout=layout.fruchterman.reingold)

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
Please suggest features or report bugs with the GitHub issue tracker.
All documentation is copyright its authors; we didn't write any of that.