Combinatorica`
Combinatorica`
Distances
As of Version 10, most of the functionality of the Combinatorica package is built into the Wolfram System. »
Distances[g,v]
returns the distances in nondecreasing order from vertex v to all vertices in g, treating g as an unweighted graph.
Details and Options
- Distances functionality is now available in the built-in Wolfram Language function GraphDistance.
- To use Distances, you first need to load the Combinatorica Package using Needs["Combinatorica`"].
Examples
Basic Examples (2)Summary of the most common use cases
In[1]:=1

✖
https://wolfram.com/xid/0kt3kmir5-rmcvi
In[2]:=2

✖
https://wolfram.com/xid/0kt3kmir5-euxtzb
In[3]:=3

✖
https://wolfram.com/xid/0kt3kmir5-c7xwog
Out[3]=3

In[4]:=4

✖
https://wolfram.com/xid/0kt3kmir5-fczqlq
Out[4]=4

Distances has been superseded by GraphDistance:
In[1]:=1

✖
https://wolfram.com/xid/0kt3kmir5-ec1xd2
Out[1]=1

In[2]:=2

✖
https://wolfram.com/xid/0kt3kmir5-q4ahb
Out[2]=2

Wolfram Research (2012), Distances, Wolfram Language function, https://reference.wolfram.com/language/Combinatorica/ref/Distances.html.
✖
Wolfram Research (2012), Distances, Wolfram Language function, https://reference.wolfram.com/language/Combinatorica/ref/Distances.html.
Text
Wolfram Research (2012), Distances, Wolfram Language function, https://reference.wolfram.com/language/Combinatorica/ref/Distances.html.
✖
Wolfram Research (2012), Distances, Wolfram Language function, https://reference.wolfram.com/language/Combinatorica/ref/Distances.html.
CMS
Wolfram Language. 2012. "Distances." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/Combinatorica/ref/Distances.html.
✖
Wolfram Language. 2012. "Distances." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/Combinatorica/ref/Distances.html.
APA
Wolfram Language. (2012). Distances. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/Combinatorica/ref/Distances.html
✖
Wolfram Language. (2012). Distances. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/Combinatorica/ref/Distances.html
BibTeX
✖
@misc{reference.wolfram_2025_distances, author="Wolfram Research", title="{Distances}", year="2012", howpublished="\url{https://reference.wolfram.com/language/Combinatorica/ref/Distances.html}", note=[Accessed: 02-April-2025
]}
BibLaTeX
✖
@online{reference.wolfram_2025_distances, organization={Wolfram Research}, title={Distances}, year={2012}, url={https://reference.wolfram.com/language/Combinatorica/ref/Distances.html}, note=[Accessed: 02-April-2025
]}