Message Boards Message Boards

How to generate random weighted graphs that obey the triangle inequality?

I am working on generating a Random Graph with weights that obeys the triangle inequality.
I will focus on the functions RandomGraph and SpatialGraphDistribution.
I can generate a graph in a flat plane that obeys the triangle inequality with SpatialGraphDistribution.
I am wondering if there is a way to make weighted edges that obey the triangle inequality.
I have an idea to find the Euclidean distance between the vertex coordinates.
I have found a way to make a random graph with weighted vertex coordinates.

Attachments:
POSTED BY: Peter Burbery

You can generate vertices in as points in space (choose your dimension), then make edge weights as the Euclidean (or Manhattan, or...) distance between any pair of vertices with an edge between them. As a final step, ignore the locations of the vertices and just embed in two or three dimensions.

POSTED BY: Daniel Lichtblau
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract