Package com.jgalgo.alg.shortestpath
Interface SimplePathsEnumerator
- All Known Implementing Classes:
SimplePathsEnumeratorAbstract
,SimplePathsEnumeratorSedgewick
public interface SimplePathsEnumerator
An algorithm that enumerate over simple paths between a source and a target.
Given a graph G=(V,E), a path is a sequence of edges e1,e2,…,ek such that ei=(vi−1,vi) and vi≠vj for i≠j. A simple path is a path that does not contain a cycle, namely the vertices visited by the path are distinct. Algorithms implementing this interface find all simple paths between a source and a target vertices in a given graph. Note that there may be exponentially many simple paths between two vertices in a graph.
Use newInstance()
to get a default implementation of this interface.
- Author:
- Barak Ugav
-
Method Summary
Modifier and TypeMethodDescriptionallSimplePaths
(Graph<V, E> g, V source, V target) Find all the simple paths between a source and a target vertices in the given graph.static SimplePathsEnumerator
Create a new algorithm for simple paths enumeration.simplePathsIter
(Graph<V, E> g, V source, V target) Iterate over all the simple paths between a source and a target vertices in the given graph.
-
Method Details
-
simplePathsIter
Iterate over all the simple paths between a source and a target vertices in the given graph.If
g
is anIntGraph
, an iterator ofIPath
objects will be returned.- Type Parameters:
V
- the vertices typeE
- the edges type- Parameters:
g
- a graphsource
- the source vertextarget
- the target vertex- Returns:
- an iterator that iteration over all simple paths between the two vertices in the graph
-
allSimplePaths
Find all the simple paths between a source and a target vertices in the given graph.If
g
is anIntGraph
, a list ofIPath
objects will be returned.- Type Parameters:
V
- the vertices typeE
- the edges type- Parameters:
g
- a graphsource
- the source vertextarget
- the target vertex- Returns:
- a list of all simple paths between the two vertices in the graph
-
newInstance
Create a new algorithm for simple paths enumeration.This is the recommended way to instantiate a new
SimplePathsEnumerator
object.- Returns:
- a default implementation of
SimplePathsEnumerator
-