Is there an algorithm that gives me the coordinates of the vertices in the graph when I give it a weighted graph, and the weight of the edges between the vertices indicates the distance between the vertices
Sort of:
public _ArrayOfCoordinatesForVertices_ **super_hyper_algorithm**(weighted_graph){ return _foo_; }
This is not possible at all: imagine a graph with three nodes n1, n2 and n3.
Now consider the following distances:
n1-n2: 4 n1-n3: 1 n2-n3: 1
(This violates the quality of the triangle).
What you're talking about is called Multidimensional Scaling (MDS) , and you have to find many implementations, now you know how to look for it.
Like others, to some extent it is impossible to build a perfect graph without violating some of your limitations (distance between points). MDS algorithms are specifically designed to minimize such violations.
If a graph is drawn in Euclidean space , you cannot do this because, as indicated in this answer , you can violate Triangular inequality .
Usually you can visually display the weights of the edges using a different color (i.e., by matching the weights with a color map) or using different thicknesses of the edges (i.e. by matching the weights with a scale of thickness).
OK, I found a library for python, and it creates a graphic image for me :), and I can give weights for edges such as the attribute: Edge weight. More precisely, the heavier the weight, the shorter the straight and more vertical edge.
Source: https://habr.com/ru/post/909387/More articles:Strange blue frame in Firefox - javascriptmapping user entity data types - c #Visualization of the distance between nodes in accordance with the weights - with R - rIterating through each text element on the page? - jqueryoverflow (scrolling) to work with negative positions "left" and "top" - htmlMobile Device Identification Using Nmap - androidC ++ and the base name entered is c ++Problem with HttpContext.Current.User.Identity.Name - asp.netjava.lang.UnsatisfiedLinkError: no gluegen-rt in java.library.path RCP application - javaGet stdout / stderr of a forked process in a subprocess - pythonAll Articles