Package org.locationtech.jts.planargraph
Class Subgraph
- java.lang.Object
-
- org.locationtech.jts.planargraph.Subgraph
-
public class Subgraph extends java.lang.Object
A subgraph of aPlanarGraph
. A subgraph may contain any subset ofEdge
s from the parent graph. It will also automatically contain allDirectedEdge
s andNode
s associated with those edges. No new objects are created when edges are added - all associated components must already exist in the parent graph.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.List
dirEdges
protected java.util.Set
edges
protected NodeMap
nodeMap
protected PlanarGraph
parentGraph
-
Constructor Summary
Constructors Constructor Description Subgraph(PlanarGraph parentGraph)
Creates a new subgraph of the givenPlanarGraph
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(Edge e)
Adds anEdge
to the subgraph.boolean
contains(Edge e)
Tests whether anEdge
is contained in this subgraphjava.util.Iterator
dirEdgeIterator()
Returns anIterator
over theDirectedEdge
s in this graph, in the order in which they were added.java.util.Iterator
edgeIterator()
Returns anIterator
over theEdge
s in this graph, in the order in which they were added.PlanarGraph
getParent()
Gets thePlanarGraph
which this subgraph is part of.java.util.Iterator
nodeIterator()
Returns anIterator
over theNode
s in this graph.
-
-
-
Field Detail
-
parentGraph
protected PlanarGraph parentGraph
-
edges
protected java.util.Set edges
-
dirEdges
protected java.util.List dirEdges
-
nodeMap
protected NodeMap nodeMap
-
-
Constructor Detail
-
Subgraph
public Subgraph(PlanarGraph parentGraph)
Creates a new subgraph of the givenPlanarGraph
- Parameters:
parentGraph
- the parent graph
-
-
Method Detail
-
getParent
public PlanarGraph getParent()
Gets thePlanarGraph
which this subgraph is part of.- Returns:
- the parent PlanarGraph
-
add
public void add(Edge e)
- Parameters:
e
- the edge to add
-
dirEdgeIterator
public java.util.Iterator dirEdgeIterator()
Returns anIterator
over theDirectedEdge
s in this graph, in the order in which they were added.- Returns:
- an iterator over the directed edges
- See Also:
add(Edge)
-
edgeIterator
public java.util.Iterator edgeIterator()
Returns anIterator
over theEdge
s in this graph, in the order in which they were added.- Returns:
- an iterator over the edges
- See Also:
add(Edge)
-
nodeIterator
public java.util.Iterator nodeIterator()
Returns anIterator
over theNode
s in this graph.- Returns:
- an iterator over the nodes
-
-