I need to plot a graph (to be specific: Fortune Algorithm output) with given vertex coordinates and a few unconnected vertices. I am thinking of using Mathematica for that.

GraphPlot does much of the task with VertexCordinateRules option but does not plot unconnected points.

  1. So is there any way to do this?
    And it would be even nicer if that graph comes with 2-D Axes. I was thinking to use ListLinePlot and Point commands but they give two different graphs as output.

  2. Is there any option for combining output from two graphs? (The Show command didn't help.)

  • $\begingroup$ What version do you have? In version 8 you can use Graph instead of GraphPlot. Is your aim to construct an actual graph, or do you merely want to plot the result (and don't want to use it in a graph-context)? $\endgroup$
    – Szabolcs
    Apr 25, 2012 at 13:17
  • $\begingroup$ I do have version 8, but Graph command doesn't seems to plot unconnected vertices. I don't think Computational geometry package will be helpful as I am looking for visualization only. $\endgroup$ Apr 25, 2012 at 17:11
  • $\begingroup$ Actually, using adjacency matrix and graph plot I am able to plot unconnected vertices but the sense of Voronoi diagram is lost as graph plot does not follow coordinates systems(i.e. no directional or distance correctness). $\endgroup$ Apr 25, 2012 at 17:42
  • $\begingroup$ @samikaran-theequation Just post a sample input dataset (in the format you have it in in Mathematica) and I'll show you how. $\endgroup$
    – Szabolcs
    Apr 25, 2012 at 18:54
  • $\begingroup$ the option i was looking for is UndirectedEdge[] in graph command. :) $\endgroup$ Apr 26, 2012 at 0:41

3 Answers 3


I didn't quite follow the description of your graph, but are you aware of this functionality?:

data = MapIndexed[Flatten[{##}] &, RandomReal[1, {100, 2}]];

 InterpolationOrder -> 0,
 ColorFunction -> Hue,
 Mesh -> All,
 Epilog -> Point@data[[All, {1, 2}]]

Mathematica graphics

Specifically note InterpolationOrder -> 0.

  • $\begingroup$ The ComputationalGeometry package has Voronoi diagrams as well. I think he's looking to visualize them only, not to compute them (suppose you'd make your own program for computing them, for whatever reason, then you need to visualize the result quickly) $\endgroup$
    – Szabolcs
    Apr 25, 2012 at 13:16
  • $\begingroup$ You're not very active lately, what happened? I'm hoping for the glorious return of Spartacus! :D $\endgroup$
    – Szabolcs
    Apr 25, 2012 at 13:18
  • $\begingroup$ Yup, I am looking just to plot my result of Voronoi diagram and not to compute them. Lets say; a={1,2};b={4,2};c={3,0};d={3,7}. So is there a way to plot an edge(c,d) and points a and b? $\endgroup$ Apr 25, 2012 at 17:05
  • $\begingroup$ @Szabolcs other hobbies. :-) $\endgroup$
    – Mr.Wizard
    Apr 25, 2012 at 17:56
  • 1
    $\begingroup$ Do you mean something like this? Graph[{a, b, c, d}, {UndirectedEdge[c,d]}, VertexCoordinates -> {{1, 2}, {4, 2}, {3, 0}, {3, 7}}] $\endgroup$
    – halmir
    Apr 25, 2012 at 22:57

Here is a nice clean way to both compute and plot the Voronoi diagram with some undocumented functions:



pts = RandomReal[6, {100, 2}];

Show[GeometryPlot[VoronoiMesh[pts], Mesh -> All, 
  PlotStyle -> {Opacity[0.3], Yellow}, 
  MeshStyle -> {Darker@Green, Dashed}], Graphics[{Red, Point[pts]}]]

Mathematica graphics


Now in Mathematica 10, VoronoiMesh is a standard built in function.

    ,Frame-> True

enter image description here

  • $\begingroup$ +1. I'm curious as no example was shown in the documentation. Does VoronoiMesh compute 3D Voronoi diagrams? $\endgroup$
    – RunnyKine
    May 18, 2014 at 22:08
  • $\begingroup$ @RunnyKine tks. I see 3D in DelaunayMesh but not for VoronoiMesh. Maybe under implementation. $\endgroup$
    – Murta
    May 18, 2014 at 22:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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