Scaling node coordinates to a fixed graph size

AI Thread Summary
To scale node coordinates from varying ranges to a fixed graph size, the coordinates must be multiplied by a scaling factor derived from the desired size compared to the original range. For instance, if the original x and y coordinates range from 0 to 1000 and the target is 0 to 500, the scaling factor is 500/1000, resulting in a multiplication by 0.5. This method ensures that the relative distances and layout of the nodes are preserved while fitting them within the new dimensions. The example provided illustrates this process, converting the point (900, 800) to (450, 400). Using this approach allows for consistent scaling across different graphs with varying node ranges.
mcnkevin
Messages
6
Reaction score
0
Hi, suppose i have various graphs which each have many nodes. In one graph the nodes x and y values may be within the range 0-1000, in another the x values may range from 100-500 and the y values from 300-800. Basically, the ranges always vary and there is no consistency.

I need a way to scale the values of the x and y coordinates such that they fit inside a fixed graph size (say 500 by 500) such that the graph retains in basic layout and relative distances between nodes.

Probably not that hard a question, i just can't figure it out :). Thx for any help.
 
Mathematics news on Phys.org
If your graph x and y range from 0 to A and you want it to fit inside 0 to B, multiply all coordinates by B/A.

For example, if you x and y coordinates are always between 0 and 1000 and you want it to fit inside 0 to 500 multiply all coordinates by 500/1000= 1/2. So, for example, the point (900,800) would change to (450, 400).
 
Insights auto threads is broken atm, so I'm manually creating these for new Insight articles. In Dirac’s Principles of Quantum Mechanics published in 1930 he introduced a “convenient notation” he referred to as a “delta function” which he treated as a continuum analog to the discrete Kronecker delta. The Kronecker delta is simply the indexed components of the identity operator in matrix algebra Source: https://www.physicsforums.com/insights/what-exactly-is-diracs-delta-function/ by...
Fermat's Last Theorem has long been one of the most famous mathematical problems, and is now one of the most famous theorems. It simply states that the equation $$ a^n+b^n=c^n $$ has no solutions with positive integers if ##n>2.## It was named after Pierre de Fermat (1607-1665). The problem itself stems from the book Arithmetica by Diophantus of Alexandria. It gained popularity because Fermat noted in his copy "Cubum autem in duos cubos, aut quadratoquadratum in duos quadratoquadratos, et...
Thread 'Imaginary Pythagorus'
I posted this in the Lame Math thread, but it's got me thinking. Is there any validity to this? Or is it really just a mathematical trick? Naively, I see that i2 + plus 12 does equal zero2. But does this have a meaning? I know one can treat the imaginary number line as just another axis like the reals, but does that mean this does represent a triangle in the complex plane with a hypotenuse of length zero? Ibix offered a rendering of the diagram using what I assume is matrix* notation...
Back
Top