directed graph: why x called tail when directed from x to y? - graph

An arc (x, y) is considered to be directed from x to y; y is called the head and x is called the tail of the arc.
https://en.wikipedia.org/wiki/Directed_graph
Why isn't x called head when edge directed from x to y?

Related

Finding a point in 3d space on a plane using 2d coordinates

visualization
I am searching the location of a point that lies on a plane. The relative location on the plane is given in u/v-Coordinates.
The normal vector n is equal to the vector from (0,0,0) to the center of the plane (or any other distance ā‰  0, if more convenient)
The plane has no rotation around the n vector - u is always on the xy axis and v on the z (up) axis
I feel like there should be a simple formula for this, given Vector3 n along with the coordinates u and v, but i'm stuck here.
You have the coordinates of the origin of the plane, namely (x, y, z)
Now we need the unit vectors u and v in global coordinates.
u is (y, -x, 0), normalized.
v is (-zx/r, -zy/r, r), normalized, where r=(x2+y2)1/2
Now you can add the location of the point in uv coordinates to the location of the plane origin in xyz coordinates.

Get a plane's center X, Y, Z, Cartesian coordinates

I need to get a plane's center X, Y, Z, Cartesian coordinates. I have the plane's normal and its center point distance to origin.
I can place a point(s) anywhere and get the distance from it. I suppose that some kind of triangulation COULD be in order. Like placing three (or however many you need) points in some fashion to get a single point.
If your plane is given in the following form:
dot(x, n) = d
, then it's quite easy to get an x that lies on the plane. Assuming that n is a unit vector, then dot(n, n) = 1. So, dot(d * n, n) = d. So one point on the plane is d * n.

Dimensions issue in 3D plotting

I have wrote the following code in scilab and want to plot it but the plot is not look like 3D. Basically the problem is dimensions, x and y are 1 cross 5 matrices and the function f is 5 cross 5 matrix. I tried to make x and y 5 dimensional by using meshgrid but then the functions can't give me result with that modified values of meshgrid(x,y). The whole code is here.
clear; clc;
//Defining the range of Cartesian coordinates (x,y,z)
x = linspace(1,30,5);
y = linspace(0,30,5);
z = linspace(0,30,5);
//------------------------------------------------------------------------------
//This funciton transform Cartesian to Spherical coordinates
function [r, theta, phi]=cart2sph(x, y, z)
r = sqrt(x^2+y^2+z^2);
theta = atan(y./x)
phi = acos(z./sqrt(x^2+y^2+z^2))'
endfunction
//------------------------------------------------------------------------------
//To get the spherical coordinates from Cartesian uing the above funciton
[r, theta, phi]=cart2sph(x, y, z)
//------------------------------------------------------------------------------
//Defining spherical hormonic as a funciton of shperical coordinates here.
function [y]=Y(l, m, theta, phi)
if m >= 0 then
y = (-1)^m/(sqrt(2*%pi))*exp(%i*m*phi)*legendre(l, m, cos(theta), "norm")
else
y = 1/(sqrt(2*%pi))*exp(%i*m*phi)*legendre(l, -m, cos(theta), "norm")
end
endfunction
l = 1; m = -1;
f = Y(l,m,theta,phi);
//I got the funciton value in spherical coordinates and
//that spherical coordinates are funciton of Cartesian coordinates.
//So basically funciton Y is a funciton of Cartesian coordinates (x,y,z).
//Next to plot funciton Y against (x,y)
//------------------------------------------------------------------------------
clf();
plot3d(x,y,f,flag=[2 4 4]); xtitle("|Y31(x,y)|");
Your problem is due to the range of f which is very small compared to the x and y ones.
To get what you expect you can proceed as follow
plot3d(x,y,f,flag=[2 4 4]); xtitle("|Y31(x,y)|");
ax=gca();
ax.cube_scaling="on";

3D Vector defined by 2 angles

So basically I'm looking for a way to calculate the x, y and z component of a vector using 2 angles as shown:
Where alpha is the 2D angle and beta is the y angle.
What I've been using uptill now for 2D vectors was:
x = Math.sin(alpha);
z = Math.cos(alpha);
After searching on stackexchange math I've found this forumula doesn't really work correctly:
x = Math.sin(alpha)*Math.cos(beta);
z = Math.sin(alpha)*Math.sin(beta);
y = Math.cos(beta);
Note: when approaching 90 degrees with the beta angle the x and z components should approach zero.
All help would be appreciated.
The proper formulas would be
x = Math.cos(alpha) * Math.cos(beta);
z = Math.sin(alpha) * Math.cos(beta);
y = Math.sin(beta);
That formula just come from the transformation of Spherical coordinates (r, theta, phi) -> (x, y, z) to Cartesian coordinates.

Prove of the farthest pair

For a graph G = (V, E) we denote the length of the shortest path between
vertices u, v āˆˆ V by dG(u, v). The diameter of G is defined as āˆ†(G) = maxu,vāˆˆV dG(u, v). A pair of vertices (u, v) that realizes the diameter is called a farthest pair.
Let u be any vertex of G and let v be a vertex that is farthest away from u
in G (i.e. maximizes dG(u, v)). Prove that, if G is an undirected tree, then v is part of a farthest pair of G.
That is the question and I have to do the prove. I assumed that there is a existence of a farthest pair (x, y) such that dG(u, v), dG(x, v), and dG(y, v) are smaller than dG(x, y). I'm trying to find a contradition out of it, by assuming that v is not a farthest pair of G.
If v is part of the farthest pair of G:
There exist a v' such that Dg(v, v') >= Dg(X, Y)
If v is not part of the farthest pair of the, we negate the statement above. Using De Morgan, we get:
For all v': not( Dg(v, v') >= Dg(X, Y) ).
For all v': Dg(v, v') < Dg(X, Y).
So now I have three statements
(x,y) is the farthest pair.
For all v': Dg(v, v') < Dg(X, Y).
v is the furthest from u.
How do I continue with the prove to prove what has to be proven?
(if G is an undirected tree, then v is part of a farthest pair of G.)
Your question is actually an exact duplicate of https://math.stackexchange.com/questions/1209922/furthest-distance-vertices-undirected-tree

Resources