public class SparseUndirectedEdgeSet extends AbstractSet<Edge> implements EdgeSet<Edge>, Serializable
Constructor and Description |
---|
SparseUndirectedEdgeSet(int rootVertex) |
Modifier and Type | Method and Description |
---|---|
boolean |
add(Edge e)
Adds the edge to this set if one of the vertices is the root vertex and
if the non-root vertex has a greater index that this vertex.
|
IntSet |
connected()
Returns the set of vertices connected to the root edges.
|
boolean |
connects(int vertex)
Returns true if the root vertex is connected to the provided vertex.
|
boolean |
contains(Object o) |
SparseUndirectedEdgeSet |
copy(IntSet vertices)
Copies the edges in this set that are connected to any of the vertices in
the provided set.
|
int |
disconnect(int vertex)
Removes all edges instances that connect to the specified vertex,
returning the number of edges that were removed, if any.
|
Set<Edge> |
getEdges(int vertex)
Returns the set of
Edge instances that connect the root vertex
with this vertex or an empty set if no such edges exist. |
int |
getRoot()
Returns the vertex to which all edges in this set are connected.
|
Iterator<Edge> |
iterator() |
boolean |
remove(Object o) |
int |
size() |
equals, hashCode, removeAll
addAll, clear, containsAll, isEmpty, retainAll, toArray, toArray, toString
public boolean add(Edge e)
add
in interface EdgeSet<Edge>
add
in interface Collection<Edge>
add
in interface Set<Edge>
add
in class AbstractCollection<Edge>
true
if the edge was added, false
if the edge was
already present, or if it could not be added to this edge set due
to the root vertex not being connected to the edgepublic IntSet connected()
public boolean connects(int vertex)
public boolean contains(Object o)
contains
in interface Collection<Edge>
contains
in interface Set<Edge>
contains
in class AbstractCollection<Edge>
public SparseUndirectedEdgeSet copy(IntSet vertices)
public int disconnect(int vertex)
disconnect
in interface EdgeSet<Edge>
public Set<Edge> getEdges(int vertex)
Edge
instances that connect the root vertex
with this vertex or an empty set if no such edges exist.public int getRoot()
public boolean remove(Object o)
remove
in interface Collection<Edge>
remove
in interface Set<Edge>
remove
in class AbstractCollection<Edge>
public int size()
size
in interface Collection<Edge>
size
in interface Set<Edge>
size
in class AbstractCollection<Edge>
Copyright © 2012. All Rights Reserved.