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 (DirectedEdge
s,
Edge
s and Node
s) 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.
Constructor and Description |
---|
PlanarGraph()
Constructs a empty graph.
|
Modifier and Type | Method and Description |
---|---|
boolean |
contains(DirectedEdge de)
Tests whether this graph contains the given
DirectedEdge |
boolean |
contains(Edge e)
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 pt)
|
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 de)
Removes a
DirectedEdge from its from-Node and from this graph. |
void |
remove(Edge edge)
Removes an
Edge and its associated DirectedEdge s
from their from-Nodes and from the graph. |
void |
remove(Node node)
Removes a node from the graph, along with any associated DirectedEdges and
Edges.
|
public Node findNode(Coordinate pt)
pt
- the location to querynull
if this graph contains no node at the locationpublic Iterator nodeIterator()
public boolean contains(Edge e)
Edge
e
- the edge to querytrue
if the graph contains the edgepublic boolean contains(DirectedEdge de)
DirectedEdge
de
- the directed edge to querytrue
if the graph contains the directed edgepublic Collection getNodes()
public Iterator dirEdgeIterator()
add(Edge)
,
add(DirectedEdge)
public Iterator edgeIterator()
add(Edge)
public Collection getEdges()
add(Edge)
public void remove(Edge edge)
public void remove(DirectedEdge de)
DirectedEdge
from its from-Node
and from this graph.
This method does not remove the Node
s associated with the DirectedEdge,
even if the removal of the DirectedEdge reduces the degree of a Node to zero.public void remove(Node node)
public List findNodesOfDegree(int degree)
Copyright © 2022. All rights reserved.