Returns the label on the edge between node1
and node2
.
Returns the label on the edge between node1
and node2
.
Throws IllegalArgumentException
if node1
and node2
are not neighbors.
Creates an edge between node1
and node2
labelled
edge
.
Creates an edge between node1
and node2
labelled
edge
. Returns true
if the edge was succesfully created.
Returns false
if the edge could not be created.
There are several reasons why an edge may not be created successfully:
(1) Either node may not exist in the graph. (2) node1
and
node2
may be the same node, but no self-loops are allowed.
(3) There may already be an edge between the two nodes.
Creates a new node in the graph.
Creates a new node in the graph. Returns false
if the node
already exists. Returns true
if the node did not exist and
was just created.
Returns the set of neighboring vertices of node
.
Returns the set of neighboring vertices of node
. Returns
the empty set if node
is not a vertex in the graph.
Removes a node from the graph.
Removes a node from the graph. Returns true
if the node
is successsfully removed, or false
if the node did not exist.
An undirected graph with labelled nodes and edges and no self-loops.