public class GraphTraversal
extends java.lang.Object
| Constructor and Description |
|---|
GraphTraversal() |
| Modifier and Type | Method and Description |
|---|---|
static <V extends Vertex,E extends Edge<V>> |
findAllPathsDFS(Graph<V,E> graph,
V source,
V target)
Finds all paths in the given graph between two provided vertices using depth-first search
|
static <V extends Vertex,E extends Edge<V>> |
findAllPathsDFS(Graph<V,E> graph,
V source,
V target,
java.util.List<V> excluding)
Finds all paths in the given graph between two provided vertices not containing any of vertices in the given list using depth-first search
|
static <V extends Vertex,E extends Edge<V>> |
findAllPathsDFSContaining(Graph<V,E> graph,
V source,
V target,
java.util.List<V> containing)
Finds all paths in the given graph between two provided vertices containing a list of vertices using depth-first search
|
static <V extends Vertex,E extends Edge<V>> |
findLongestPath(Graph<V,E> graph)
Finds the longest path in a graph
Method should be rewritten to increase its effectiveness
|
static <V extends Vertex,E extends Edge<V>> |
nonrecursiveDFSPath(Graph<V,E> graph,
V source,
V target)
A non-recursive implementation of the depth-first search for finding a path between two vertices
More efficient than the recursive implementation
|
public static <V extends Vertex,E extends Edge<V>> java.util.List<Path<V,E>> findAllPathsDFS(Graph<V,E> graph, V source, V target)
V - The vertex typeE - The edge typegraph - Graphsource - Source vertextarget - Target (destination) vertexgraph between source and target verticespublic static <V extends Vertex,E extends Edge<V>> java.util.List<Path<V,E>> findAllPathsDFSContaining(Graph<V,E> graph, V source, V target, java.util.List<V> containing)
V - The vertex typeE - The edge typegraph - Graphsource - Source vertextarget - Target (destination) vertexcontaining - A list of vertices the path must containgraph between source and target vertices containing all of the containing vertices.public static <V extends Vertex,E extends Edge<V>> java.util.List<Path<V,E>> findAllPathsDFS(Graph<V,E> graph, V source, V target, java.util.List<V> excluding)
V - The vertex typeE - The edge typegraph - Graphsource - Source vertextarget - Target (destination) vertexexcluding - A list of vertices the path shouldn't containgraph between source and target vertices not containing any of the excluding vertices.public static <V extends Vertex,E extends Edge<V>> Path<V,E> nonrecursiveDFSPath(Graph<V,E> graph, V source, V target)
V - The vertex typeE - The edge typegraph - Graphsource - Source vertextarget - Target (destination) vertexgraph between source and target verticespublic static <V extends Vertex,E extends Edge<V>> Path<V,E> findLongestPath(Graph<V,E> graph)
V - The vertex typeE - The edge type1graph - The graph