[Date Index]
[Thread Index]
[Author Index]
Re: Using GraphPlot to draw an empty graph
*To*: mathgroup at smc.vnet.net
*Subject*: [mg105381] Re: [mg105358] Using GraphPlot to draw an empty graph
*From*: Murray Eisenberg <murray at math.umass.edu>
*Date*: Mon, 30 Nov 2009 06:11:42 -0500 (EST)
*Organization*: Mathematics & Statistics, Univ. of Mass./Amherst
*References*: <200911291011.FAA16287@smc.vnet.net>
*Reply-to*: murray at math.umass.edu
You can finesse this by using the form
GraphPlot[m]
where m is the adjacency matrix. For example, for a 3-vertex null graph:
GraphPlot[ConstantArray[0, {3, 3}]]
J. McKenzie Alexander wrote:
> Hello,
>
> Is there a way of making GraphPlot draw an empty graph? I realise that
> this is an ill-defined question if one uses the default options for
> GraphPlot because there is no way for GraphPlot to know how many
> vertices it should draw. However, it turns out that even if one set a
> custom value for VertexCoordinateRule the vertices aren't drawn:
>
> GraphPlot[{},
> VertexRenderingFunction -> ({Black, Disk[#1, 0.05] } &),
> VertexCoordinateRules ->
> Table[{Cos[theta], Sin[theta]}, {theta, 0, 2 Pi, 2 Pi/11}]
> ]
>
> I know that I could easily draw this "by hand" using Graphics, but I
> have good reason for wanting to use GraphPlot. (I wrap the GraphPlot in
> Dynamic where the list of edges is specified by a variable. Most of the
> time the variable contains a connected graph, but sometimes it is
> empty.)
>
> As an aside, the following "works" as a way of giving the impression of
> an empty graph, but it does so by forcing each node to have a self-loop
> (and then suppressing those edges from being drawn). It would be nice to
> have a cleaner solution.
>
> GraphPlot[Table[i -> i, {i, 0, 11}],
> VertexRenderingFunction -> ({Black, Disk[#1, 0.05]} &),
> SelfLoopStyle -> None,
> VertexCoordinateRules ->
> Table[N[{Cos[theta], Sin[theta]}], {theta, 0, 2 Pi, 2 Pi/11}]
> ]
>
> Cheers,
>
> Jason
>
> --
> Dr J. McKenzie Alexander
> Department of Philosophy, Logic and Scientific Method
> London School of Economics and Political Science
> Houghton Street, London WC2A 2AE
>
>
>
>
--
Murray Eisenberg murray at math.umass.edu
Mathematics & Statistics Dept.
Lederle Graduate Research Tower phone 413 549-1020 (H)
University of Massachusetts 413 545-2859 (W)
710 North Pleasant Street fax 413 545-1801
Amherst, MA 01003-9305
Prev by Date:
**Re: countour plot (in 3D)**
Next by Date:
**Re: Re: Bug ??????**
Previous by thread:
**Re: Using GraphPlot to draw an empty graph**
Next by thread:
**piecewice pdf, problems with cdf**
| |