Package org.graph4j.util
Class Path
- Direct Known Subclasses:
Cycle
A path is a trail with no duplicate vertices.
Vertices can not repeat. Edges can not repeat.
The length of a walk is its number of edges.
- Author:
- Cristian Frăsinaru
- See Also:
-
Field Summary
Fields inherited from class org.graph4j.util.VertexCollection
bitset, DEFAULT_CAPACITY, first, graph, numVertices, vertices -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintbooleanA Hamiltonian path contains all vertices in the graph.booleanChecks if the path is induced (there is no chord).booleanisValid()intMethods inherited from class org.graph4j.util.Trail
checkDuplicateEdgesMethods inherited from class org.graph4j.util.Walk
add, checkEdge, checkEdges, computeEdgesWeight, equals, hashCode, isClosed, isDirected, length, reverse, toString, typeMethods inherited from class org.graph4j.util.VertexList
addAll, get, indexOf, indexOf, insert, remove, removeFromPos, set, union, unionMethods inherited from class org.graph4j.util.VertexCollection
clear, computeVerticesWeight, contains, getGraph, grow, isClique, isEmpty, isStableSet, iterator, numVertices, removeAll, removeLast, retainAll, size, union, vertexToString, verticesMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
Path
-
Path
-
Path
-
-
Method Details
-
firstVertex
public int firstVertex() -
lastVertex
public int lastVertex() -
isValid
public boolean isValid() -
isInduced
public boolean isInduced()Checks if the path is induced (there is no chord).- Returns:
trueif the path is induced,falseotherwise.
-
isHamiltonian
public boolean isHamiltonian()A Hamiltonian path contains all vertices in the graph.- Returns:
trueif the path is Hamiltonian.
-