MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: graphs

  • To: mathgroup at
  • Subject: [mg60983] Re: [mg60946] graphs
  • From: "David Park" <djmp at>
  • Date: Thu, 6 Oct 2005 04:08:25 -0400 (EDT)
  • Sender: owner-wri-mathgroup at


1) Do add all the set of diagonal edges to an n x n graph you could use...

g2 = g;
Do[If[Mod[i, n] != 0, g2 = AddEdges[g2, {i, i + n + 1}]],
  {i, 1, n^2 - (n + 1)}]

3) To better show all the vertex labels use PlotRange -> All.

  VertexNumber -> True,
  PlotRange -> All]

2) To retain the numbering of the vertices don't remove the vertices. Just
remove the edges that lead to the vertices.

You might want to look at the Combinatorica Graphics package at my web site
below. It gives more control on the rendering of the graph. You could, for
example, use circles containing the vertex numbers at the vertices. I think
you could suppress the display of some vertices. You could also use directed
edges with the arrowheads in the center instead of at the end of the edges.

The Combinatorica package is poorly documented.

David Park
djmp at

From: leigh pascoe [mailto:leigh at]
To: mathgroup at

Dear Mathgroup,

I am using Combinatorica to study a board game represented by a graph.
The nxn graph can be created using


The vertices of the graph are numbered from the bottom left in rows,
hence to refer to the matrix (row,column) location of a vertex we define
a linking function.


Now to complete the graph we draw edges from cell(i,j) to cell(i-1,j+1),
where these vertices exist. Here is an example for the 4x4 case


This works ok, but I now have several problems: I would like to write
the above statement as an implied loop for a general nxn gridgraph. I
can't seem to get the correct syntax for this. Can anyone help me?

Then I would like to define some functions on the graph, referring to
the vertices by there grid position. However when I add or delete a
vertex, the numbering on the graph changes. I would like to be able
mutate the graph, but still be able to address vertices by the original
labels, as defined by the cellindex[i,j] function (or any other for that
matter. Any suggestions?

A third problem (bug?) is that in the ShowGraph command the vertex label
on the left loses the left most digit(s) when displayed, as shown above.
I just note that here in case someone at Wolfram wants to fix it.

The documentation for this package is also rather (very) limited. I
bought the book on the package, which gives some more details, but many
functions still remain undocumented. Does anyone know a better source?

Thanks for your replies.


  • Prev by Date: Re: Visualization site updates
  • Next by Date: Re: Assigning (really dumb question)
  • Previous by thread: graphs
  • Next by thread: Re: "Mathematica in Education and Research"