graph
Class Graph

java.lang.Object
  |
  +--graph.Graph

public class Graph
extends java.lang.Object

A Graph object represents a planar graph (or better, map). The data structures stores a list of vertices and faces. The vertices know about the faces around them, and vice versa. The edge structure is determined by the relationship of vertices and faces.

Rather than loading this class with tons of structural information, we implement things roughly on a Model-Controller-Viewer design pattern. The Graph Class is the Model for the data, and constructors contain the controller code. The various viewers take different structural views of this class (View scores, view structures, format conversions, etc). All controller code lies in the constructors, because the Graph Class is immutable.

The purpose of this code is to prove part of the Kepler conjecture. Specifically: 1. Give a fresh implementation of the graph package at www.math.lsa.umich.edu/~hales/countdown/graph. 2. Give a useful data structure for use in the linear programming part of the Kepler conjecture


Inner Class Summary
static class Graph.Test
          Test Class contains test code.
 
Method Summary
 Graph add(Face[] F, Vertex[] newFaceVertexList)
          Graph with one new polygon added along an edge.
 boolean contains(Face F)
           
 boolean contains(Vertex V)
           
 Graph copy(boolean reverse, Vertex[] vList, Face[] fList)
          deepClone or deepMirrorImage of the graph.
 java.util.Enumeration faceEnumeration()
          Enumerates all Face objects.
 int faceSize()
          The number of faces in the graph
 Vertex getBaseVertex()
           
static Graph getInstance(Formatter f)
          Construct a graph from a formatter object.
static Graph getInstance(int size)
          Construct a polygon graph.
static Graph getInstance(int[] seedData)
          Construct graph from seedData giving a graph around one vertex.
protected  void setBaseVertex(Vertex V)
           
 java.util.Enumeration vertexEnumeration()
          Enumerates all Vertex objects.
 int vertexSize()
          The number of vertices in the graph.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

contains

public boolean contains(Vertex V)

contains

public boolean contains(Face F)

getBaseVertex

public Vertex getBaseVertex()

setBaseVertex

protected void setBaseVertex(Vertex V)

vertexSize

public int vertexSize()
The number of vertices in the graph.

faceSize

public int faceSize()
The number of faces in the graph

vertexEnumeration

public java.util.Enumeration vertexEnumeration()
Enumerates all Vertex objects. The order has no intrinsice significance, but it is preserved under cloning and mirror images. Objects may be safely cast to Vertex.

faceEnumeration

public java.util.Enumeration faceEnumeration()
Enumerates all Face objects. The order is preserved under cloning and mirror images. Under faceDivision, one face (face21) keeps the order of the parent, and the other is added to the end of the Enumeration. Objects can be safely cast to (Face).

getInstance

public static Graph getInstance(int size)
Construct a polygon graph.
Parameters:
size - the number of vertices in the polygon.

getInstance

public static Graph getInstance(Formatter f)
Construct a graph from a formatter object. The enumeration order is preserved.

copy

public Graph copy(boolean reverse,
                  Vertex[] vList,
                  Face[] fList)
deepClone or deepMirrorImage of the graph.
Parameters:
G - graph to clone
vList - any array of Vertices on G,
fList - any array of Faces on G.
reverse - if true, a mirror image of G is constructed.

add

public Graph add(Face[] F,
                 Vertex[] newFaceVertexList)
Graph with one new polygon added along an edge.

Parameters:
F - list of length 1 containing the Face to be modified.
newFaceVertexList, - all vertices cyclically arranged (clockwise), nulls for new Vertices.

getInstance

public static Graph getInstance(int[] seedData)
Construct graph from seedData giving a graph around one vertex. See graphConstruct.gif
Parameters:
seedData - a clockwise array of integers specifying sizes of consecutive faces.