Description Usage Arguments Value Examples

Computes shortest path lengths for an unweighted, undirected graph. For
graphs with these properties, this function is much faster than the function
`distances`

in the igraph package.

1 | ```
shortest_path_lengths(graph, nodes = V(graph))
``` |

`graph` |
an igraph object. |

`nodes` |
a subset of the nodes of the graph to find the distances between. defaults to all nodes (all pairs shortest path lengths). |

returns a symmetric "matrix" object where the *ij*th entry is the
shortest path distance from *v_i* to *v_j*, *d(v_i,v_j)*, for all
*v_i,v_j \in V*.

1 2 3 4 | ```
sp <- shortest_path_lengths(dolphins);
sp[1:10,1:10];
## Check against igraphs distance function
all(sp == igraph::distances(dolphins, algorithm = "unweighted"));
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.