|
|||||||||
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). |
Method Summary | |
---|---|
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. |
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. |
int |
getEdgeCount()
Return the number of edges 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. |
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. |
Methods inherited from class java.lang.Object |
---|
equals, 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 listMethod 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()
public QEdge addEdge(Node node0, Node node1)
public Graph getDual()
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 |