Package org.apache.calcite.util.graph
Class DefaultDirectedGraph<V,E extends DefaultEdge>
java.lang.Object
org.apache.calcite.util.graph.DefaultDirectedGraph<V,E>
- Type Parameters:
V
- Vertex typeE
- Edge type
- All Implemented Interfaces:
DirectedGraph<V,
E>
- Direct Known Subclasses:
AttributedDirectedGraph
public class DefaultDirectedGraph<V,E extends DefaultEdge>
extends Object
implements DirectedGraph<V,E>
Default implementation of
DirectedGraph
.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.calcite.util.graph.DirectedGraph
DirectedGraph.EdgeFactory<V,
E> -
Constructor Summary
ConstructorDescriptionDefaultDirectedGraph
(@UnknownInitialization DirectedGraph.EdgeFactory<V, E> edgeFactory) Creates a graph. -
Method Summary
Modifier and TypeMethodDescription@Nullable E
Adds an edge to this graph.boolean
Adds a vertex to this graph.static <V> DefaultDirectedGraph<V,
DefaultEdge> create()
static <V,
E extends DefaultEdge>
DefaultDirectedGraph<V,E> create
(DirectedGraph.EdgeFactory<V, E> edgeFactory) edgeSet()
@Nullable E
getInwardEdges
(V target) getOutwardEdges
(V source) void
removeAllVertices
(Collection<V> collection) Removes from this graph all vertices that are incollection
, and the edges into and out of those vertices.boolean
removeEdge
(V source, V target) toString()
-
Constructor Details
-
DefaultDirectedGraph
Creates a graph.
-
-
Method Details
-
create
-
create
public static <V,E extends DefaultEdge> DefaultDirectedGraph<V,E> create(DirectedGraph.EdgeFactory<V, E> edgeFactory) -
toStringUnordered
-
toString
-
addVertex
Description copied from interface:DirectedGraph
Adds a vertex to this graph.- Specified by:
addVertex
in interfaceDirectedGraph<V,
E extends DefaultEdge> - Parameters:
vertex
- Vertex- Returns:
- Whether vertex was added
-
getVertex
-
edgeSet
- Specified by:
edgeSet
in interfaceDirectedGraph<V,
E extends DefaultEdge>
-
addEdge
Description copied from interface:DirectedGraph
Adds an edge to this graph.- Specified by:
addEdge
in interfaceDirectedGraph<V,
E extends DefaultEdge> - Parameters:
vertex
- Source vertextargetVertex
- Target vertex- Returns:
- New edge, if added, otherwise null
-
getEdge
- Specified by:
getEdge
in interfaceDirectedGraph<V,
E extends DefaultEdge>
-
removeEdge
- Specified by:
removeEdge
in interfaceDirectedGraph<V,
E extends DefaultEdge>
-
vertexSet
- Specified by:
vertexSet
in interfaceDirectedGraph<V,
E extends DefaultEdge>
-
removeAllVertices
Description copied from interface:DirectedGraph
Removes from this graph all vertices that are incollection
, and the edges into and out of those vertices.- Specified by:
removeAllVertices
in interfaceDirectedGraph<V,
E extends DefaultEdge>
-
getOutwardEdges
- Specified by:
getOutwardEdges
in interfaceDirectedGraph<V,
E extends DefaultEdge>
-
getInwardEdges
- Specified by:
getInwardEdges
in interfaceDirectedGraph<V,
E extends DefaultEdge>
-