Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I have a list of edges defined based on vertices like this:

Edges={{2, 1}, {10, 9}, {11, 10}, {11, 4}, {17, 12},.....} 
(*Where each number is the index of a vertex which has 3D coordinates*)

In order to plot a graph I first made Edges looks like this (I want to plot undirected graph)

edges = Flatten[Table[{Edges[[i, 1]] <-> Edges[[i, 2]]}, {i, 1, Length[Edges]}]];

Then I plot the graph

GraphPlot3D[edges, VertexLabeling -> False, (*VertexCoordinateRules -> nodescoord*), \BoxRatios -> Automatic,ViewPoint -> {0, 0, -Infinity}];

Where am I wrong? Is it the way I define edges using "<->"?

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

Use Graph[] instead of GraphPlot[]

n = 8;
vC = RandomReal[{0, 1}, {n, 3}];
edges = UndirectedEdge @@@ Subsets[Range@n, {2}];
Graph[edges, VertexCoordinates -> vC]

Mathematica graphics

share|improve this answer
    
@ belisarius,Thanks, I thought graph can only display 2D images. But why VertexLabels -> "Name" property fails. And, is there a place to share mine and use Mathematica extension packages written by others? –  novice Dec 23 '13 at 5:58
    
@novice You can talk about that in chat chat.stackexchange.com –  belisarius Dec 23 '13 at 6:16
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.