Package org.jgrapht.graph
Class MixedGraphUnion<V,E>
- java.lang.Object
-
- org.jgrapht.graph.AbstractGraph<V,E>
-
- org.jgrapht.graph.GraphUnion<V,E,Graph<V,E>>
-
- org.jgrapht.graph.MixedGraphUnion<V,E>
-
- Type Parameters:
V
- the vertex typeE
- the edge type
- All Implemented Interfaces:
java.io.Serializable
,DirectedGraph<V,E>
,Graph<V,E>
public class MixedGraphUnion<V,E> extends GraphUnion<V,E,Graph<V,E>> implements DirectedGraph<V,E>
Read-only union of an undirected and a directed graph.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private DirectedGraph<V,E>
directedGraph
private static long
serialVersionUID
private UndirectedGraph<V,E>
undirectedGraph
-
Constructor Summary
Constructors Constructor Description MixedGraphUnion(UndirectedGraph<V,E> g1, DirectedGraph<V,E> g2)
Construct a new graph union.MixedGraphUnion(UndirectedGraph<V,E> g1, DirectedGraph<V,E> g2, WeightCombiner operator)
Construct a new graph union.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Set<E>
incomingEdgesOf(V vertex)
Returns a set of all edges incoming into the specified vertex.int
inDegreeOf(V vertex)
Returns the "in degree" of the specified vertex.int
outDegreeOf(V vertex)
Returns the "out degree" of the specified vertex.java.util.Set<E>
outgoingEdgesOf(V vertex)
Returns a set of all edges outgoing from the specified vertex.-
Methods inherited from class org.jgrapht.graph.GraphUnion
addEdge, addEdge, addVertex, containsEdge, containsVertex, edgeSet, edgesOf, getAllEdges, getEdge, getEdgeFactory, getEdgeSource, getEdgeTarget, getEdgeWeight, getG1, getG2, removeEdge, removeEdge, removeVertex, vertexSet
-
Methods inherited from class org.jgrapht.graph.AbstractGraph
assertVertexExist, containsEdge, equals, hashCode, removeAllEdges, removeAllEdges, removeAllEdges, removeAllVertices, toString, toStringFromSets
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.jgrapht.Graph
addEdge, addEdge, addVertex, containsEdge, containsEdge, containsVertex, edgeSet, edgesOf, getAllEdges, getEdge, getEdgeFactory, getEdgeSource, getEdgeTarget, getEdgeWeight, removeAllEdges, removeAllEdges, removeAllVertices, removeEdge, removeEdge, removeVertex, vertexSet
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
undirectedGraph
private final UndirectedGraph<V,E> undirectedGraph
-
directedGraph
private final DirectedGraph<V,E> directedGraph
-
-
Constructor Detail
-
MixedGraphUnion
public MixedGraphUnion(UndirectedGraph<V,E> g1, DirectedGraph<V,E> g2, WeightCombiner operator)
Construct a new graph union.- Parameters:
g1
- the undirected graphg2
- the directed graphoperator
- the weight combiner (policy for edge weight calculation)
-
MixedGraphUnion
public MixedGraphUnion(UndirectedGraph<V,E> g1, DirectedGraph<V,E> g2)
Construct a new graph union. The union will use theWeightCombiner.SUM
weight combiner.- Parameters:
g1
- the undirected graphg2
- the directed graph
-
-
Method Detail
-
inDegreeOf
public int inDegreeOf(V vertex)
Description copied from interface:DirectedGraph
Returns the "in degree" of the specified vertex. An in degree of a vertex in a directed graph is the number of inward directed edges from that vertex. See http://mathworld.wolfram.com/Indegree.html.- Specified by:
inDegreeOf
in interfaceDirectedGraph<V,E>
- Parameters:
vertex
- vertex whose degree is to be calculated.- Returns:
- the degree of the specified vertex.
-
incomingEdgesOf
public java.util.Set<E> incomingEdgesOf(V vertex)
Description copied from interface:DirectedGraph
Returns a set of all edges incoming into the specified vertex.- Specified by:
incomingEdgesOf
in interfaceDirectedGraph<V,E>
- Parameters:
vertex
- the vertex for which the list of incoming edges to be returned.- Returns:
- a set of all edges incoming into the specified vertex.
-
outDegreeOf
public int outDegreeOf(V vertex)
Description copied from interface:DirectedGraph
Returns the "out degree" of the specified vertex. An out degree of a vertex in a directed graph is the number of outward directed edges from that vertex. See http://mathworld.wolfram.com/Outdegree.html.- Specified by:
outDegreeOf
in interfaceDirectedGraph<V,E>
- Parameters:
vertex
- vertex whose degree is to be calculated.- Returns:
- the degree of the specified vertex.
-
outgoingEdgesOf
public java.util.Set<E> outgoingEdgesOf(V vertex)
Description copied from interface:DirectedGraph
Returns a set of all edges outgoing from the specified vertex.- Specified by:
outgoingEdgesOf
in interfaceDirectedGraph<V,E>
- Parameters:
vertex
- the vertex for which the list of outgoing edges to be returned.- Returns:
- a set of all edges outgoing from the specified vertex.
-
-