Package org.goplanit.utils.graph
Class EdgeUtils
- java.lang.Object
-
- org.goplanit.utils.graph.EdgeUtils
-
public class EdgeUtils extends Object
Utilities for edges that do not belong within the Edge class itself
-
-
Constructor Summary
Constructors Constructor Description EdgeUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Vertex
getSharedVertex(Edge edge1, Edge edge2)
Collect shared vertex between two edges if any existsstatic <E extends Edge,V extends Vertex>
voidupdateEdgeVertices(Iterable<E> edges, Function<V,V> vertexToVertexMapping, boolean replaceMissingMappings)
Update the vertices of all edges based on the mapping provided.
-
-
-
Method Detail
-
getSharedVertex
public static Vertex getSharedVertex(Edge edge1, Edge edge2)
Collect shared vertex between two edges if any exists- Parameters:
edge1
- to checkedge2
- to check- Returns:
- shared vertex, null if none is found
-
updateEdgeVertices
public static <E extends Edge,V extends Vertex> void updateEdgeVertices(Iterable<E> edges, Function<V,V> vertexToVertexMapping, boolean replaceMissingMappings)
Update the vertices of all edges based on the mapping provided. If no mapping exists, the edge will be assigned a null reference, unless indicated otherwise- Type Parameters:
E
- type of edgeV
- type of vertex- Parameters:
edges
- to update vertices forvertexToVertexMapping
- to use should contain original vertex as currently used on edge and then the value is the new vertex to replace itreplaceMissingMappings
- when true missing mappings results in a null assignment, otherwise they are left in-tact
-
-