|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.uci.ics.dillenco.simplegraph01.Graph
public class Graph
A Graph
object represents a graph.
A graph can be
Constructor Summary | |
---|---|
Graph()
Constructs an empty graph (without vertices or edges). |
|
Graph(int nodeCapacity,
int edgeCapacity)
Constructs an empty graph (without vertices or edges). |
|
Graph(int nodeCapacity,
int edgeCapacity,
boolean dualFlag)
Constructs an empty graph (without vertices or edges). |
Method Summary | |
---|---|
(package private) void |
add(Node node)
Add a node to this graph. |
(package private) void |
add(QEdge e)
Add an edge to this graph. |
(package private) void |
add(QEdge e,
boolean link)
Add an edge to this graph. |
QEdge |
addEdge(Node node0,
Node node1)
Create a new edge and add it to this graph. |
Node |
addNode()
Create a new node and add it to this graph. |
(package private) void |
decrementNextNodeSeqID()
Decrement the next available node sequential ID value. |
void |
dump()
Prints a dump of the graph on the standard output |
void |
dump(PrintStream stream)
Prints a dump of the graph on the specified print stream. |
void |
dump(String s)
Prints a dump of the graph with specified identifying label string on the standard output. |
void |
dump(String s,
PrintStream stream)
Prints a dump of the graph with specified identifying label string on the specified print stream. |
Iterable<HalfEdge> |
getDirectedEdges()
Returns an Iterable with an iterator that runs through all directed edges of this graph, ignoring undirected edges. |
Iterable<HalfEdge> |
getDirectedEdges(boolean check)
Returns an Iterable with an iterator that runs through all directed edges of this graph. |
Graph |
getDual()
Return the dual of this graph, if one has been computed. |
(package private) boolean |
getDualFlag()
Return a flag indicating whether this is a "primal" or "dual" graph. |
int |
getEdgeCount()
Return the number of edges in this graph. |
(package private) HalfEdge |
getFirstHalfEdge()
Return the first halfEdge in this graph. |
Iterable<HalfEdge> |
getHalfEdges(boolean both)
Returns an Iterable with an iterator that runs through all HalfEdges of this graph. |
int |
getID()
Returns the id associated with this graph. |
(package private) int |
getNextEdgePermID()
Get the next available node edge ID value and increment the seed. |
(package private) int |
getNextNodePermID()
Get the next available node permanent ID value and increment the seed. |
(package private) int |
getNextNodeSeqID()
Get the next available node sequential ID value and increment the seed. |
int |
getNodeCount()
Return the number of nodes in this graph. |
Iterable<Node> |
getNodes()
Returns an Iterable with an iterator that runs through all Nodes of this graph. |
Iterable<QEdge> |
getQEdges()
Returns an Iterable with an iterator that runs through all QEdges of this graph. |
void |
link(QEdge qEdge,
Node node)
Link the specified edge into the rotation system at the indicated node. |
(package private) void |
setID(int n)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Graph()
public Graph(int nodeCapacity, int edgeCapacity)
nodeCapacity
- the initial capacity of the node listedgeCapacity
- the initial capacity of the edge listGraph(int nodeCapacity, int edgeCapacity, boolean dualFlag)
nodeCapacity
- the initial capacity of the node listedgeCapacity
- the initial capacity of the edge listdualFlag
- true if this graph is constructed as a dualMethod Detail |
---|
public void dump(String s)
s
- a label string to identify the dumppublic void dump()
public void dump(PrintStream stream)
stream
- the print stream where the dump should be printedpublic void dump(String s, PrintStream stream)
s
- a label string to identify the dumpstream
- the print stream where the dump should be printedpublic int getID()
public Iterable<Node> getNodes()
hasNext()
and next()
methods.
If remove()
is called on the returned iterator,
an UnsupportedOperationException
will be thrown.
public Iterable<QEdge> getQEdges()
hasNext()
and next()
methods.
If remove()
is called on the returned iterator,
an UnsupportedOperationException
will be thrown.
public Iterable<HalfEdge> getHalfEdges(boolean both)
hasNext()
and next()
methods.
If remove()
is called on the returned iterator,
an UnsupportedOperationException
will be thrown.
both
- if true, a half edge for each of the two half edges
associated with an edge will be returned; otherwise,
just one of them
public Iterable<HalfEdge> getDirectedEdges()
getDirectedEdges
(false)
.
public Iterable<HalfEdge> getDirectedEdges(boolean check)
GraphCheckException
to be thrown, depending on the value of check
.
Each directed edge will be returned exactly once, but the order is
unspecified.
The iterator only supports the hasNext()
and next()
methods.
If remove()
is called on the returned iterator,
an UnsupportedOperationException
will be thrown.
check
- if true, and the graph contains any undirected edges, a
GraphCheckException is thrown
public Node addNode()
void add(Node node)
node
- node to be added.public QEdge addEdge(Node node0, Node node1)
void add(QEdge e)
add
(e,false)
.
e
- edge to be added.void add(QEdge e, boolean link)
e
- edge to be added.link
- true if edge is to be linked into vertex structure.
If link
is set true,
edges will be linked in an unspecified order,
so this should only be done if order of edges around vertices
is not important.void setID(int n)
public Graph getDual()
boolean getDualFlag()
HalfEdge getFirstHalfEdge()
int getNextNodePermID()
int getNextNodeSeqID()
void decrementNextNodeSeqID()
int getNextEdgePermID()
public int getNodeCount()
public int getEdgeCount()
public void link(QEdge qEdge, Node node)
qEdge
- the QEdge to be linkednode
- the Node into whose rotation system the edge is linked
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |