Class EdgeGraph

Hierarchy: Object , EdgeGraph
Direct Known Subclasses: DissolveEdgeGraph
public class EdgeGraph
A graph comprised of HalfEdges. It supports tracking the vertices in the graph via edges incident on them, to allow efficient lookup of edges and vertices.

This class may be subclassed to use a different subclass of HalfEdge, by overriding createEdge(Coordinate). If additional logic is required to initialize edges then EdgeGraph.addEdge(Coordinate, Coordinate) can be overridden as well.

Authors:
Martin Davis
public EdgeGraph()
protected HalfEdge createEdge(Coordinate orig)
Creates a single HalfEdge. Override to use a different HalfEdge subclass.
Parameters:
orig - orig the origin location
Returns:
a new HalfEdge with the given origin
public HalfEdge addEdge(Coordinate orig, Coordinate dest)
Adds an edge between the coordinates orig and dest to this graph. Only valid edges can be added (in particular, zero-length segments cannot be added)
Parameters:
orig - orig the edge origin location
dest - dest the edge destination location.
See also:
#isValidEdge(Coordinate, Coordinate)
Returns:
the created edge
null if the edge was invalid and not added
public static boolean isValidEdge(Coordinate orig, Coordinate dest)
Tests if the given coordinates form a valid edge (with non-zero length).
Parameters:
orig - orig the start coordinate
dest - dest the end coordinate
Returns:
true if the edge formed is valid
public Collection getVertexEdges()
public HalfEdge findEdge(Coordinate orig, Coordinate dest)
Finds an edge in this graph with the given origin and destination, if one exists.
Parameters:
orig - orig the origin location
dest - dest the destination location.
Returns:
an edge with the given orig and dest, or null if none exists