SetEdgeWeights[g]
assigns random real weights in the range [0,1] to edges in g.
SetEdgeWeights[g,e]
assigns edge weights to the edges in the edge list e.
SetEdgeWeights[g,w]
assigns the weights in the weight list w to the edges of g.
SetEdgeWeights[g,e,w]
assigns the weights in the weight list w to the edges in edge list e.


SetEdgeWeights
SetEdgeWeights[g]
assigns random real weights in the range [0,1] to edges in g.
SetEdgeWeights[g,e]
assigns edge weights to the edges in the edge list e.
SetEdgeWeights[g,w]
assigns the weights in the weight list w to the edges of g.
SetEdgeWeights[g,e,w]
assigns the weights in the weight list w to the edges in edge list e.
Details and Options
- SetEdgeWeights functionality is now available in the built-in Wolfram Language function EdgeWeight.
- To use SetEdgeWeights, you first need to load the Combinatorica Package using Needs["Combinatorica`"].
- SetEdgeWeights accepts options WeightingFunction and WeightRange. The default value for WeightingFunction is Random, and the default value for WeightRange is [0,1].
- WeightingFunction can take values Random, RandomInteger, Euclidean, or LNorm[n] for non-negative n, or any pure function that takes two arguments, each argument having the form {Integer,{Number,Number}}.
- WeightRange can be an integer range or a real range.
See Also
Tech Notes
Related Guides
-
▪
- Displaying Graphs ▪
- Graph Construction and Representations ▪
- Graphs & Networks ▪
- Graph Visualization ▪
- Computation on Graphs ▪
- Graph Construction & Representation ▪
- Graphs and Matrices ▪
- Graph Properties & Measurements ▪
- Graph Operations and Modifications ▪
- Statistical Analysis ▪
- Social Network Analysis ▪
- Graph Properties ▪
- Mathematical Data Formats ▪
- Discrete Mathematics
Text
Wolfram Research (2012), SetEdgeWeights, Wolfram Language function, https://reference.wolfram.com/language/Combinatorica/ref/SetEdgeWeights.html.
CMS
Wolfram Language. 2012. "SetEdgeWeights." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/Combinatorica/ref/SetEdgeWeights.html.
APA
Wolfram Language. (2012). SetEdgeWeights. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/Combinatorica/ref/SetEdgeWeights.html
BibTeX
@misc{reference.wolfram_2025_setedgeweights, author="Wolfram Research", title="{SetEdgeWeights}", year="2012", howpublished="\url{https://reference.wolfram.com/language/Combinatorica/ref/SetEdgeWeights.html}", note=[Accessed: 14-August-2025]}
BibLaTeX
@online{reference.wolfram_2025_setedgeweights, organization={Wolfram Research}, title={SetEdgeWeights}, year={2012}, url={https://reference.wolfram.com/language/Combinatorica/ref/SetEdgeWeights.html}, note=[Accessed: 14-August-2025]}