Re: Re: Using GraphPlot to draw an empty graph
- To: mathgroup at smc.vnet.net
- Subject: [mg105435] Re: [mg105381] Re: [mg105358] Using GraphPlot to draw an empty graph
- From: "J. McKenzie Alexander" <jalex at lse.ac.uk>
- Date: Wed, 2 Dec 2009 06:27:52 -0500 (EST)
- References: <200911291011.FAA16287@smc.vnet.net> <200911301111.GAA13302@smc.vnet.net>
Many thanks to all those who responded. One further question: how does one assign labels to edges if calling GraphPlot on an adjacency matrix? I tried the following (which struck me as a natural guess at what the syntax might be), but it failed: GraphPlot[ { {0, {1, 0.5}, {1, 0.5}}, { {1, 0.5}, 0, {1, 0.5}}, { {1, 0.5}, {1, 0.5}, 0}}, MultiedgeStyle -> True] >From what I see in the documentation, there doesn't seem to be a way to include edge labels using the adjacency matrix representation, unless I explicitly override EdgeRenderingFunction. Is that right? Cheers, Jason On 30 Nov 2009, at 11:11, Murray Eisenberg wrote: > 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 > -- Dr J. McKenzie Alexander Department of Philosophy, Logic and Scientific Method London School of Economics and Political Science Houghton Street, London WC2A 2AE Please access the attached hyperlink for an important electronic communications disclaimer: http://www.lse.ac.uk/collections/secretariat/legal/disclaimer.htm
- Follow-Ups:
- Re: Re: Re: Using GraphPlot to draw
- From: Murray Eisenberg <murray@math.umass.edu>
- Re: Re: Re: Using GraphPlot to draw