Package org.graph4j.util
Class VertexList
java.lang.Object
org.graph4j.util.VertexCollection
org.graph4j.util.VertexList
- Direct Known Subclasses:
Walk
A list of vertices of a graph. A vertex can appear multiple times.
- 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
ConstructorsConstructorDescriptionVertexList(Graph graph) VertexList(Graph graph, int initialCapacity) VertexList(Graph graph, int[] vertices) -
Method Summary
Modifier and TypeMethodDescriptionbooleanadd(int v) Adds the vertex in the collection.voidaddAll(int... vertices) intget(int pos) Returns the vertex at the specified position in this list.intindexOf(int v) intindexOf(int v, int startPos) voidinsert(int pos, int v) Inserts a vertex at the specified position in this list.booleanremove(int v) Removes a vertex from the collection.voidremoveFromPos(int pos) voidset(int pos, int v) Replaces the vertex at the specified position in this list with the specified vertex.union(int... other) union(VertexList other) Methods inherited from class org.graph4j.util.VertexCollection
clear, computeVerticesWeight, contains, equals, getGraph, grow, hashCode, isClique, isEmpty, isStableSet, iterator, numVertices, removeAll, removeLast, retainAll, size, toString, 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
-
VertexList
-
VertexList
-
VertexList
-
-
Method Details
-
remove
public boolean remove(int v) Description copied from class:VertexCollectionRemoves a vertex from the collection.- Overrides:
removein classVertexCollection- Parameters:
v- a vertex number- Returns:
- true, if the collection changed as a result of this call
-
removeFromPos
public void removeFromPos(int pos) - Overrides:
removeFromPosin classVertexCollection
-
add
public boolean add(int v) Description copied from class:VertexCollectionAdds the vertex in the collection.- Overrides:
addin classVertexCollection- Parameters:
v- a vertex number- Returns:
- true, if the collection changed as a result of this call
-
addAll
public void addAll(int... vertices) - Overrides:
addAllin classVertexCollection- Parameters:
vertices- an array of vertex numbers.
-
indexOf
public int indexOf(int v) - Overrides:
indexOfin classVertexCollection- Parameters:
v- a vertex number- Returns:
- the position of the first appearance of v in the array, or -1 if v does not belong to it
-
indexOf
public int indexOf(int v, int startPos) - Overrides:
indexOfin classVertexCollection- Parameters:
v- a vertex numberstartPos- the start position- Returns:
- the position of the first appearance of v in the array, starting with the given position (inclusive), or -1 if v does not belong to it
-
get
public int get(int pos) Returns the vertex at the specified position in this list.- Parameters:
pos- a position in the list- Returns:
- the vertex at the specified position
-
set
public void set(int pos, int v) Replaces the vertex at the specified position in this list with the specified vertex.- Parameters:
pos- position of the vertex to replace.v- a vertex number.
-
insert
public void insert(int pos, int v) Inserts a vertex at the specified position in this list.- Parameters:
pos- position where the vertex must be inserted.v- a vertex number.
-
union
- Parameters:
other- an array of vertex numbers.- Returns:
- a new list containing vertices belonging to this list or the other array.
-
union
- Parameters:
other- a list of vertex numbers.- Returns:
- a new list containing vertices belonging to this list or the other.
-