Package org.apache.calcite.util.graph
Class AttributedDirectedGraph<V,E extends DefaultEdge>
- java.lang.Object
-
- org.apache.calcite.util.graph.DefaultDirectedGraph<V,E>
-
- org.apache.calcite.util.graph.AttributedDirectedGraph<V,E>
-
- Type Parameters:
V
- Vertex typeE
- Edge type
- All Implemented Interfaces:
DirectedGraph<V,E>
public class AttributedDirectedGraph<V,E extends DefaultEdge> extends DefaultDirectedGraph<V,E>
Directed graph where edges have attributes and allows multiple edges between any two vertices provided that their attributes are different.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
AttributedDirectedGraph.AttributedEdgeFactory<V,E>
Factory for edges that have attributes.-
Nested classes/interfaces inherited from class org.apache.calcite.util.graph.DefaultDirectedGraph
DefaultDirectedGraph.VertexInfo<V,E>
-
Nested classes/interfaces inherited from interface org.apache.calcite.util.graph.DirectedGraph
DirectedGraph.EdgeFactory<V,E>
-
-
Field Summary
-
Fields inherited from class org.apache.calcite.util.graph.DefaultDirectedGraph
edgeFactory, edges, vertexMap
-
-
Constructor Summary
Constructors Constructor Description AttributedDirectedGraph(AttributedDirectedGraph.AttributedEdgeFactory<V,E> edgeFactory)
Creates an attributed graph.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description E
addEdge(V vertex, V targetVertex)
Deprecated.E
addEdge(V vertex, V targetVertex, java.lang.Object... attributes)
static <V,E extends DefaultEdge>
AttributedDirectedGraph<V,E>create(AttributedDirectedGraph.AttributedEdgeFactory<V,E> edgeFactory)
E
getEdge(V source, V target)
Returns the first edge between one vertex to another.java.lang.Iterable<E>
getEdges(V source, V target)
Returns all edges between one vertex to another.boolean
removeEdge(V source, V target)
Removes all edges from a given vertex to another.-
Methods inherited from class org.apache.calcite.util.graph.DefaultDirectedGraph
addVertex, create, create, edgeSet, getInwardEdges, getOutwardEdges, removeAllVertices, source, target, toString, toStringUnordered, vertexSet
-
-
-
-
Constructor Detail
-
AttributedDirectedGraph
public AttributedDirectedGraph(AttributedDirectedGraph.AttributedEdgeFactory<V,E> edgeFactory)
Creates an attributed graph.
-
-
Method Detail
-
create
public static <V,E extends DefaultEdge> AttributedDirectedGraph<V,E> create(AttributedDirectedGraph.AttributedEdgeFactory<V,E> edgeFactory)
-
getEdge
public E getEdge(V source, V target)
Returns the first edge between one vertex to another.- Specified by:
getEdge
in interfaceDirectedGraph<V,E extends DefaultEdge>
- Overrides:
getEdge
in classDefaultDirectedGraph<V,E extends DefaultEdge>
-
addEdge
@Deprecated public E addEdge(V vertex, V targetVertex)
Deprecated.Description copied from interface:DirectedGraph
Adds an edge to this graph.- Specified by:
addEdge
in interfaceDirectedGraph<V,E extends DefaultEdge>
- Overrides:
addEdge
in classDefaultDirectedGraph<V,E extends DefaultEdge>
- Parameters:
vertex
- Source vertextargetVertex
- Target vertex- Returns:
- New edge, if added, otherwise null
-
getEdges
public java.lang.Iterable<E> getEdges(V source, V target)
Returns all edges between one vertex to another.
-
removeEdge
public boolean removeEdge(V source, V target)
Removes all edges from a given vertex to another. Returns whether any were removed.- Specified by:
removeEdge
in interfaceDirectedGraph<V,E extends DefaultEdge>
- Overrides:
removeEdge
in classDefaultDirectedGraph<V,E extends DefaultEdge>
-
-