Class GraphPack.DirGraph
All Packages    This Package    Previous    Next

Class GraphPack.DirGraph

java.lang.Object
   |
   +----GraphPack.Graph
           |
           +----GraphPack.DirGraph

public class DirGraph
extends Graph
implements GraphInterface
This implements a directed graph data structure as an extension of class Graph. DirGraph relies on DirVertex and DirEdge, which extend class Vertex and Edge, respectively.

DirGraph contains a separate Edge object for each direction of an edge between two vertices. Within each edge, V1 is the source vertex, and V2 is the destination

DirVertices have two separate lists of attached edges: outgoing and incoming edges. NOTE: when DirGraph is treated like a Graph object, the command getAttachedEdges(vertex) returns ONLY outgoing edges.


DirGraph(UndoMan)

adde(Edge)
add (Dir)Edge e to graph
adde(Vertex, Vertex)
create, add, and return an edge between v1 and v2
addv(double, double)
create, insert, and return new vertex with x, y coordinates in graph
addv(double, double, int)
create, insert, and return new vertex with x, y coordinates in graph
convert()
return a new nondirected graph version of this graph
dele(Edge)
delete edge e from graph
delv(Vertex)
delete vertex v from graph
getIncEdges(Vertex)
return a list of vertex v's incoming edges
getOutgEdges(Vertex)
return a list of vertex v's outgoing edges

DirGraph
  public DirGraph(UndoMan _um)

convert
  public GraphInterface convert()
return a new nondirected graph version of this graph
Overrides:
convert in class Graph

addv

  public Vertex addv(double x,
                     double y)
create, insert, and return new vertex with x, y coordinates in graph
Overrides:
addv in class Graph

addv

  public Vertex addv(double x,
                     double y,
                     int tempnum)
create, insert, and return new vertex with x, y coordinates in graph
Overrides:
addv in class Graph

delv

  public void delv(Vertex v)
delete vertex v from graph
Overrides:
delv in class Graph

getOutgEdges

  public EdgeList getOutgEdges(Vertex v)
return a list of vertex v's outgoing edges

getIncEdges

  public EdgeList getIncEdges(Vertex v)
return a list of vertex v's incoming edges

adde

  public void adde(Edge e)
add (Dir)Edge e to graph
Overrides:
adde in class Graph

adde

  public Edge adde(Vertex v1,
                   Vertex v2)
create, add, and return an edge between v1 and v2
Overrides:
adde in class Graph

dele

  public void dele(Edge e)
delete edge e from graph
Overrides:
dele in class Graph


All Packages    This Package    Previous    Next