public abstract class PlanarGraph extends Object
This class and the other classes in this package serve as a framework for building planar graphs for specific algorithms. This class must be subclassed to expose appropriate methods to construct the graph. This allows controlling the types of graph components (DirectedEdges, Edges and Nodes) which can be added to the graph. An application which uses the graph framework will almost always provide subclasses for one or more graph components, which hold application-specific data and graph algorithms.
| Modifier and Type | Field and Description |
|---|---|
protected Set |
dirEdges
|
protected Set |
edges
|
protected NodeMap |
nodeMap
|
| Constructor and Description |
|---|
PlanarGraph()
Constructs a empty graph.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
add(DirectedEdge
Adds the Edge to this PlanarGraph; only subclasses can add DirectedEdges, to ensure the edges added are of the right class.
|
protected void |
add(Edge
Adds the Edge and its DirectedEdges with this PlanarGraph.
|
protected void |
add(Node
Adds a node to the map, replacing any that is already at that location.
|
boolean |
contains(DirectedEdge
Tests whether this graph contains the given
DirectedEdge
|
boolean |
contains(Edge
Tests whether this graph contains the given
Edge
|
Iterator |
dirEdgeIterator()
Returns an Iterator over the DirectedEdges in this PlanarGraph, in the order in which they were added.
|
Iterator |
edgeIterator()
Returns an Iterator over the Edges in this PlanarGraph, in the order in which they were added.
|
Node |
findNode(Coordinate
|
List |
findNodesOfDegree(int degree)
Returns all Nodes with the given number of Edges around it.
|
Collection |
getEdges()
Returns the Edges that have been added to this PlanarGraph
|
Collection |
getNodes()
|
Iterator |
nodeIterator()
Returns an Iterator over the Nodes in this PlanarGraph.
|
void |
remove(DirectedEdge
Removes a
DirectedEdge from its from-
Node and from this graph.
|
void |
remove(Edge
Removes an
Edge and its associated
DirectedEdges from their from-Nodes and from the graph.
|
void |
remove(Node
Removes a node from the graph, along with any associated DirectedEdges and Edges.
|
protected Setedges
protected SetdirEdges
protected NodeMapnodeMap
public NodefindNode(Coordinate pt)
pt - the location to query
null if this graph contains no node at the location
protected void add(Nodenode)
node - the node to add
protected void add(Edgeedge)
protected void add(DirectedEdgedirEdge)
public IteratornodeIterator()
public boolean contains(Edgee)
Edge
e - the edge to query
true if the graph contains the edge
public boolean contains(DirectedEdgede)
DirectedEdge
de - the directed edge to query
true if the graph contains the directed edge
public CollectiongetNodes()
public IteratordirEdgeIterator()
add(Edge),
add(DirectedEdge)
public IteratoredgeIterator()
add(Edge)
public CollectiongetEdges()
add(Edge)
public void remove(Edgeedge)
public void remove(DirectedEdgede)
DirectedEdge from its from-
Node and from this graph. This method does not remove the
Nodes associated with the DirectedEdge, even if the removal of the DirectedEdge reduces the degree of a Node to zero.
public void remove(Nodenode)
public ListfindNodesOfDegree(int degree)