# Graphs in 3 dimensions

I have a desired graph as here: the dashed line is just for perspective representation. I tried with LayeredGraphPlot and GraphPlot3D but I don't know how I can show perceptively in 3 dimensions with LayeredGraphPlot or a curved lines in GraphPlot3D.

The scales in schematic picture are completely arbitrary but in order to achieve the graph, also showing the axes of coordinators are not needed, I should have presented here to be more clear! and stacking i ,j, k, l, m, n on the vertex (small circle on shape) can be desired.

For version 10: here is a problem at which I have encountered in running the David G.Stork code:

For version 9: although I don't write show in the last line but I just want to present the problem is related to create graph!

ef[pts_List, e_] := {Arrowheads[{0, .05, 0}],
Arrow[BezierCurve[{pts[[1]], pts[[1]] + {0, 0, 1},
pts[[2]] + {0, 0, 1}, pts[[2]]}]]};

myfig = Graph[{Style[1 -> 2, Thickness[0.005], Yellow],
Style[1 -> 4, Yellow, Dashing[0.02]], Style[1 -> 6, Yellow],
Style[2 -> 3, Green], Style[3 -> 4, Green], Style[4 -> 5, Green],
Style[5 -> 6, Green]}, EdgeShapeFunction -> ef,
VertexCoordinates -> {1 -> {2, 0, 1}, 2 -> {0, 0, 0},
3 -> {1, -1, 0}, 4 -> {2, -1, 0}, 5 -> {3, -1, 0},
6 -> {4, 0, 0}}, Background -> LightGray]


But the output will be as below (just for showing output)

• Try with Graphics3D[ ] instead – Dr. belisarius Dec 1 '15 at 21:00
• I can't curve smoothly lines in Graphics3D, they are sharply curved! – monfneg Dec 1 '15 at 21:10

ef[pts_List, e_] :=
Arrow[
BezierCurve[
{pts[[1]],
pts[[1]] + {0, 0, 1},
pts[[2]] + {0, 0, 1},
pts[[2]]}]]};

myfig = Graph[
{Style[1 -> 2, Thickness[0.005], Yellow],
Style[1 -> 4, Yellow, Dashing[0.02]], Style[1 -> 6, Yellow],
Style[2 -> 3, Green], Style[3 -> 4, Green], Style[4 -> 5, Green],
Style[5 -> 6, Green]},

EdgeShapeFunction -> ef,

VertexCoordinates -> {1 -> {2, 0, 1},
2 -> {0, 0, 0},
3 -> {1, -1, 0},
4 -> {2, -1, 0},
5 -> {3, -1, 0},
6 -> {4, 0, 0}},
Background -> LightGray];

Show[myfig,
Graphics3D[
{Arrow[{{0, 0, 0}, {5, 0, 0}}],
Arrow[{{0, 0, 0}, {0, -3, 0}}],
Arrow[{{0, 0, 0}, {0, 0, 3}}],
{Dashed, Line[{{0, -1, 0}, {5, -1, 0}}]}}
]]


• So much thanks, Although I can understand most of the process of your code but I can't re construct your shape. I encounter to this message: Objects of "unequal length in {2.,0.}+{0,0,1} cannot be combined", "Objects of unequal length in {0.,0.}+{0,0,1} cannot be combined" ,"Objects of unequal length in {2.,0.}+{0,0,1} cannot be combined"!!! – monfneg Dec 2 '15 at 2:16
• Your vertex coordinates must be three-dimensional, i.e., {0,0,0} and {1, -1, 0}. You should just copy my code and run it directly. – David G. Stork Dec 2 '15 at 2:32
• I just copy your code and run. because I can't upload a picture in comment, I am uploading that in the main question. please take a look at that. – monfneg Dec 2 '15 at 3:11
• @user36028 - start with a fresh kernel. – Bob Hanlon Dec 2 '15 at 4:02
• I started a fresh kernel! I even use of version 9, however the previous message does not appear again but another surprising message appears I upload that – monfneg Dec 2 '15 at 4:41