Class DirectionTransformer
- java.lang.Object
-
- edu.uci.ics.jung.algorithms.transformation.DirectionTransformer
-
public class DirectionTransformer extends java.lang.Object
Functions for transforming graphs into directed or undirected graphs.
-
-
Constructor Summary
Constructors Constructor Description DirectionTransformer()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <V,E>
edu.uci.ics.jung.graph.Graph<V,E>toDirected(edu.uci.ics.jung.graph.Graph<V,E> graph, org.apache.commons.collections4.Factory<edu.uci.ics.jung.graph.DirectedGraph<V,E>> graph_factory, org.apache.commons.collections4.Factory<E> edge_factory, boolean create_new)
Transformsgraph
(which may be of any directionality) into a directed graph.static <V,E>
edu.uci.ics.jung.graph.UndirectedGraph<V,E>toUndirected(edu.uci.ics.jung.graph.Graph<V,E> graph, org.apache.commons.collections4.Factory<edu.uci.ics.jung.graph.UndirectedGraph<V,E>> graph_factory, org.apache.commons.collections4.Factory<E> edge_factory, boolean create_new)
Transformsgraph
(which may be of any directionality) into an undirected graph.
-
-
-
Method Detail
-
toUndirected
public static <V,E> edu.uci.ics.jung.graph.UndirectedGraph<V,E> toUndirected(edu.uci.ics.jung.graph.Graph<V,E> graph, org.apache.commons.collections4.Factory<edu.uci.ics.jung.graph.UndirectedGraph<V,E>> graph_factory, org.apache.commons.collections4.Factory<E> edge_factory, boolean create_new)
Transformsgraph
(which may be of any directionality) into an undirected graph. (This may be useful for visualization tasks). Specifically:-
Vertices are copied from
graph
. Directed edges are 'converted' into a single new undirected edge in the new graph. Each undirected edge (if any) ingraph
is 'recreated' with a new undirected edge in the new graph ifcreate_new
is true, or copied fromgraph
otherwise.- Parameters:
graph
- the graph to be transformedcreate_new
- specifies whether existing undirected edges are to be copied or recreatedgraph_factory
- used to create the new graph objectedge_factory
- used to create new edges- Returns:
- the transformed
Graph
-
toDirected
public static <V,E> edu.uci.ics.jung.graph.Graph<V,E> toDirected(edu.uci.ics.jung.graph.Graph<V,E> graph, org.apache.commons.collections4.Factory<edu.uci.ics.jung.graph.DirectedGraph<V,E>> graph_factory, org.apache.commons.collections4.Factory<E> edge_factory, boolean create_new)
Transformsgraph
(which may be of any directionality) into a directed graph. Specifically:-
Vertices are copied from
graph
. Undirected edges are 'converted' into two new antiparallel directed edges in the new graph. Each directed edge (if any) ingraph
is 'recreated' with a new edge in the new graph ifcreate_new
is true, or copied fromgraph
otherwise.- Parameters:
graph
- the graph to be transformedcreate_new
- specifies whether existing directed edges are to be copied or recreatedgraph_factory
- used to create the new graph objectedge_factory
- used to create new edges- Returns:
- the transformed
Graph
-
-