public class DirectionTransformer extends Object
Functions for transforming graphs into directed or undirected graphs.
Constructor and Description |
---|
DirectionTransformer() |
Modifier and Type | Method and Description |
---|---|
static <V,E> Graph<V,E> |
toDirected(Graph<V,E> graph,
com.google.common.base.Supplier<DirectedGraph<V,E>> graph_factory,
com.google.common.base.Supplier<E> edge_factory,
boolean create_new)
Transforms
graph (which may be of any directionality)
into a directed graph. |
static <V,E> UndirectedGraph<V,E> |
toUndirected(Graph<V,E> graph,
com.google.common.base.Supplier<UndirectedGraph<V,E>> graph_factory,
com.google.common.base.Supplier<E> edge_factory,
boolean create_new)
Transforms
graph (which may be of any directionality)
into an undirected graph. |
public static <V,E> UndirectedGraph<V,E> toUndirected(Graph<V,E> graph, com.google.common.base.Supplier<UndirectedGraph<V,E>> graph_factory, com.google.common.base.Supplier<E> edge_factory, boolean create_new)
graph
(which may be of any directionality)
into an undirected graph. (This may be useful for
visualization tasks).
Specifically:
graph
.
graph
is 'recreated' with a new undirected edge in the new
graph if create_new
is true, or copied from graph
otherwise.
V
- the vertex typeE
- the edge typegraph
- 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 edgesGraph
public static <V,E> Graph<V,E> toDirected(Graph<V,E> graph, com.google.common.base.Supplier<DirectedGraph<V,E>> graph_factory, com.google.common.base.Supplier<E> edge_factory, boolean create_new)
graph
(which may be of any directionality)
into a directed graph.
Specifically:
graph
.
graph
is 'recreated' with a new edge in the new
graph if create_new
is true, or copied from graph
otherwise.
V
- the vertex typeE
- the edge typegraph
- 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 edgesGraph
Copyright © 2015. All rights reserved.