Package com.jgalgo.alg
Interface TreePathMaxima.Queries<V,E>
-
- Type Parameters:
V- the vertices typeE- the edges type
- All Known Subinterfaces:
TreePathMaxima.IQueries
- Enclosing interface:
- TreePathMaxima
public static interface TreePathMaxima.Queries<V,E>Queries container forTreePathMaximacomputations.Queries are added one by one to this container, and than the Queries object is passed to a
TreePathMaximaalgorithm usingTreePathMaxima.computeHeaviestEdgeInTreePaths(Graph, WeightFunction, Queries).- Author:
- Barak Ugav
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddQuery(V u, V v)Add a query for the heaviest edge in a tree between two vertices.voidclear()Clear the container from all existing queries.VgetQuerySource(int idx)Get a query source by index.VgetQueryTarget(int idx)Get a query target by index.static <V,E>
TreePathMaxima.Queries<V,E>newInstance()Create an empty queries container.intsize()Get the number of queries in this container.
-
-
-
Method Detail
-
newInstance
static <V,E> TreePathMaxima.Queries<V,E> newInstance()
Create an empty queries container.- Type Parameters:
V- the vertices typeE- the edges type- Returns:
- a new queries container
-
addQuery
void addQuery(V u, V v)
Add a query for the heaviest edge in a tree between two vertices.- Parameters:
u- the first vertexv- the second vertex
-
getQuerySource
V getQuerySource(int idx)
Get a query source by index.A query is composed of two vertices, the source and the target. This method return the source vertex of a query. Use
getQueryTarget(int)to get the target vertex.- Parameters:
idx- index of the query. Must be in range[0, size())- Returns:
- the first vertex of the query
- Throws:
IndexOutOfBoundsException- ifidx < 0oridx >= size()
-
getQueryTarget
V getQueryTarget(int idx)
Get a query target by index.A query is composed of two vertices, the target and the source. This method return the target vertex of a query. Use
getQueryTarget(int)to get the source vertex.- Parameters:
idx- index of the query. Must be in range[0, size())- Returns:
- the second vertex of the query
- Throws:
IndexOutOfBoundsException- ifidx < 0oridx >= size()
-
size
int size()
Get the number of queries in this container.- Returns:
- the number of queries in this container
-
clear
void clear()
Clear the container from all existing queries.
-
-