Interface GraphPack.GraphInterface
All Packages    This Package    Previous    Next

Interface GraphPack.GraphInterface

public interface GraphInterface
extends Object
Graph implements a graph data structure with the additional feature of highlighted vertices and edges.

The graph contains a list of all vertices, which is accessed through getV(). Similarly, getE() returns the list of all edges. To examine all vertices in the graph, use a loop:

for(Vertex v=.getV(); v!=null; v=v.nextVertex())

Similarly for the edges use:

for(EdgeList e=.getE(); e!=null; e=e.nextEdge())

The graph also contains a subset of vertices which are highlighted. To access all highlighted vertices use:

for(Vertex v=.getHV(); v!=null; v=v.nextHVertex())

or edges:

for(EdgeList e=.getHE(); e!=null; e=e.nextHEdge())


HEEmpty()
return true if no highlighted edges
HEManyElt()
return true if there are >= 2 highlighted edges
HESingleElt()
HEbetweenHV()
highlight all edges between highlighted vertices
HVEmpty()
return true if no highlighted vertices
HVManyElt()
return true if there are >= 2 highlighted vertices
HVSingleElt()
Hall()
make all edges and vertices highlighted
addToHE(Edge)
add e to set of highlighted edges precond: e is not highlighted
addToHV(Vertex)
add v to set of highlighted vertices precond: v is not highlighted
adde(Edge)
add Edge e to graph
adde(Vertex, Vertex)
create and add edge between v1 and v2.
addv(Vertex)
insert vertex v into graph.

precond: v is not already in graph

addv(double, double)
create and insert vertex with x, y coordinates into graph and return new vertex
addv(double, double, int)
create and insert vertex with x, y coordinates and a given temporary number into graph and return new vertex
clearAll()
clear (delete) all vertices and edges
clearHE()
make set of highlighted edges empty
clearHV()
make set of highlighted vertices empty
connectToHV(Vertex)
create & add edge from v to every highlighted vertex
convert()
return a directed graph which is equivalent to this graph: there will be an edge in each direction.
copy()
return a copy of this graph
copyHV()
return a graph containing copies of all highlighted vertices and edges between them
cutHV()
remove all highlighted vertices and edges between them, and return a graph containing this removed portion of the graph
delFromHE(Edge)
remove e from set of highlighted edges precond: e is highlighted
delFromHV(Vertex)
remove v from set of highlighted vertices precond: v is highlighted
delHE()
delete all highlighted edges
delHV()
delete all highlighted vertices
dele(Edge)
delete edge e from graph
delv(Vertex)
delete vertex v from graph
eIn(Vertex, Vertex)
return true if there is an edge between v1 and v2, else false
enumerateV()
assign all vertices temporary consecutive numbers - return highest num
findEdge(Edge)
return edge which is "equal" to e, where "equal" is defined by class Edge\'s method equals
findEdge(Vertex, Vertex)
return the edge between v1 and v2, return null if no edge between v1,v2
findVertex(Vertex)
return a vertex which is "equal" to v, where "equal" is defined by Vertex\'s method equals
getAttachedEdges(Vertex)
return list of edges which are attached to vertex v
getE()
return list of all edges
getHE()
return list of highlighted edges NOTE: user will have to use nextHEdge to traverse list
getHV()
return list of highlighted vertices NOTE: user will have to use nextHVertex to traverse list
getV()
return list of all vertices
isDir()
return true only if this is a directed graph
moveAllHV(double, double)
translate all highlighted vertices by (xtrans, ytrans)
pasteGraph(GraphInterface, double, double)
insert a copy of graph g into this graph, with one of the new nodes at (x,y).
setUndoMan(UndoMan)
Set the undo manager for the graph
toString()
return string representation of graph
toStringH()
transv(Vertex, double, double)
translate vertex v by (xtrans, ytrans)
vIn(Vertex)
return true if v is in graph, else false

setUndoMan
  public abstract void setUndoMan(UndoMan um)
Set the undo manager for the graph

isDir

  public abstract boolean isDir()
return true only if this is a directed graph

convert

  public abstract GraphInterface convert()
return a directed graph which is equivalent to this graph: there will be an edge in each direction.

clearAll

  public abstract void clearAll()
clear (delete) all vertices and edges

addv

  public abstract void addv(Vertex v)
insert vertex v into graph.

precond: v is not already in graph

addv

  public abstract Vertex addv(double x,
                              double y)
create and insert vertex with x, y coordinates into graph and return new vertex

addv

  public abstract Vertex addv(double x,
                              double y,
                              int tempnum)
create and insert vertex with x, y coordinates and a given temporary number into graph and return new vertex

findVertex

  public abstract Vertex findVertex(Vertex v)
return a vertex which is "equal" to v, where "equal" is defined by Vertex\'s method equals

delv

  public abstract void delv(Vertex v)
delete vertex v from graph

vIn

  public abstract boolean vIn(Vertex v)
return true if v is in graph, else false

getV

  public abstract Vertex getV()
return list of all vertices

getAttachedEdges

  public abstract EdgeList getAttachedEdges(Vertex v)
return list of edges which are attached to vertex v

transv

  public abstract void transv(Vertex v,
                              double xtrans,
                              double ytrans)
translate vertex v by (xtrans, ytrans)

enumerateV

  public abstract int enumerateV()
assign all vertices temporary consecutive numbers - return highest num

adde

  public abstract void adde(Edge e)
add Edge e to graph

adde

  public abstract Edge adde(Vertex v1,
                            Vertex v2)
create and add edge between v1 and v2. return new edge

findEdge

  public abstract Edge findEdge(Edge e)
return edge which is "equal" to e, where "equal" is defined by class Edge\'s method equals

findEdge

  public abstract Edge findEdge(Vertex v1,
                                Vertex v2)
return the edge between v1 and v2, return null if no edge between v1,v2

dele

  public abstract void dele(Edge e)
delete edge e from graph

eIn

  public abstract boolean eIn(Vertex v1,
                              Vertex v2)
return true if there is an edge between v1 and v2, else false

getE

  public abstract EdgeList getE()
return list of all edges

toString

  public abstract String toString()
return string representation of graph
Overrides:
toString in class Object

toStringH

  public abstract String toStringH()
HVEmpty
  public abstract boolean HVEmpty()
return true if no highlighted vertices

HEEmpty

  public abstract boolean HEEmpty()
return true if no highlighted edges

HVSingleElt

  public abstract boolean HVSingleElt()
HESingleElt
  public abstract boolean HESingleElt()
HVManyElt
  public abstract boolean HVManyElt()
return true if there are >= 2 highlighted vertices

HEManyElt

  public abstract boolean HEManyElt()
return true if there are >= 2 highlighted edges

Hall

  public abstract void Hall()
make all edges and vertices highlighted

getHV

  public abstract Vertex getHV()
return list of highlighted vertices NOTE: user will have to use nextHVertex to traverse list

getHE

  public abstract EdgeList getHE()
return list of highlighted edges NOTE: user will have to use nextHEdge to traverse list

addToHV

  public abstract void addToHV(Vertex v)
add v to set of highlighted vertices precond: v is not highlighted

addToHE

  public abstract void addToHE(Edge e)
add e to set of highlighted edges precond: e is not highlighted

delFromHV

  public abstract void delFromHV(Vertex v)
remove v from set of highlighted vertices precond: v is highlighted

delFromHE

  public abstract void delFromHE(Edge e)
remove e from set of highlighted edges precond: e is highlighted

delHV

  public abstract void delHV()
delete all highlighted vertices

delHE

  public abstract void delHE()
delete all highlighted edges

clearHV

  public abstract void clearHV()
make set of highlighted vertices empty

clearHE

  public abstract void clearHE()
make set of highlighted edges empty

HEbetweenHV

  public abstract void HEbetweenHV()
highlight all edges between highlighted vertices

connectToHV

  public abstract void connectToHV(Vertex v)
create & add edge from v to every highlighted vertex

moveAllHV

  public abstract void moveAllHV(double xtrans,
                                 double ytrans)
translate all highlighted vertices by (xtrans, ytrans)

copy

  public abstract GraphInterface copy()
return a copy of this graph

copyHV

  public abstract GraphInterface copyHV()
return a graph containing copies of all highlighted vertices and edges between them

cutHV

  public abstract GraphInterface cutHV()
remove all highlighted vertices and edges between them, and return a graph containing this removed portion of the graph

pasteGraph

  public abstract void pasteGraph(GraphInterface g,
                                  double x,
                                  double y)
insert a copy of graph g into this graph, with one of the new nodes at (x,y).

note: to make it easy to move pasted graph - highlighted set becomes the newly pasted nodes


All Packages    This Package    Previous    Next