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.
Inherited Members
Namespace: NetTopologySuite.EdgeGraph
Assembly: NetTopologySuite.dll
Syntax
public class EdgeGraph
Remarks
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 AddEdge(Coordinate, Coordinate) can be overridden as well.
Methods
| Edit this page View SourceAddEdge(Coordinate, Coordinate)
Adds an edge between the coordinates orig and dest to this graph.
Declaration
public virtual HalfEdge AddEdge(Coordinate orig, Coordinate dest)
Parameters
| Type | Name | Description |
|---|---|---|
| Coordinate | orig | the edge origin location |
| Coordinate | dest | the edge destination location |
Returns
| Type | Description |
|---|---|
| HalfEdge | The created edge |
Remarks
Only valid edges can be added (in particular, zero-length segments cannot be added)
See Also
| Edit this page View SourceCreateEdge(Coordinate)
Creates a single HalfEdge. Override to use a different HalfEdge subclass.
Declaration
protected virtual HalfEdge CreateEdge(Coordinate orig)
Parameters
| Type | Name | Description |
|---|---|---|
| Coordinate | orig | the origin location |
Returns
| Type | Description |
|---|---|
| HalfEdge | a new HalfEdge with the given origin |
FindEdge(Coordinate, Coordinate)
Finds an edge in this graph with the given origin and destination, if one exists.
Declaration
public HalfEdge FindEdge(Coordinate orig, Coordinate dest)
Parameters
| Type | Name | Description |
|---|---|---|
| Coordinate | orig | the origin location |
| Coordinate | dest | the destination location |
Returns
| Type | Description |
|---|---|
| HalfEdge | an edge with the given orig and dest, or null if none exists |
GetVertexEdges()
Gets all HalfEdges in the graph. Both edges of edge pairs are included.
Declaration
public IEnumerable<HalfEdge> GetVertexEdges()
Returns
| Type | Description |
|---|---|
| IEnumerable<HalfEdge> | An enumeration of the graph edges |
IsValidEdge(Coordinate, Coordinate)
Test if an the coordinates for an edge form a valid edge (with non-zero length)
Declaration
public static bool IsValidEdge(Coordinate orig, Coordinate dest)
Parameters
| Type | Name | Description |
|---|---|---|
| Coordinate | orig | The start coordinate |
| Coordinate | dest | The end coordinate |
Returns
| Type | Description |
|---|---|
| bool |
|