public class Node
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
java.awt.Color |
color |
int |
index
index of a node: an integer value from 0..n-1
|
java.lang.String |
label
label of the node: vertex label can differ from vertex index
|
java.util.ArrayList<Node> |
neighbors
list of neighbors of the current node
|
int |
tag
tag of node: useful for "marking" a node
|
double |
weight
weight of the node: useful for some applications
|
Constructor and Description |
---|
Node(int index) |
Node(int index,
java.awt.Color color) |
Node(int index,
java.awt.Color color,
java.lang.String label) |
Modifier and Type | Method and Description |
---|---|
void |
addNeighbor(Node v) |
boolean |
adjacent(Node v) |
int |
degree() |
java.lang.String |
getLabel() |
int |
getTag() |
int |
hashCode() |
boolean |
isIsolated()
Check whether the current node is isolated (no neighbors)
|
java.util.List<Node> |
neighborsList()
Return the list of neighboring nodes
|
void |
removeNeighbor(Node v) |
void |
setColor(int r,
int g,
int b) |
void |
setLabel(java.lang.String label) |
void |
setTag(int tag) |
java.lang.String |
toString() |
public java.util.ArrayList<Node> neighbors
public java.lang.String label
public int tag
public double weight
public int index
public java.awt.Color color
public Node(int index)
public Node(int index, java.awt.Color color)
public Node(int index, java.awt.Color color, java.lang.String label)
public void addNeighbor(Node v)
public void removeNeighbor(Node v)
public boolean adjacent(Node v)
public boolean isIsolated()
public void setColor(int r, int g, int b)
public java.util.List<Node> neighborsList()
public void setTag(int tag)
public int getTag()
public void setLabel(java.lang.String label)
public java.lang.String getLabel()
public int degree()
public java.lang.String toString()
toString
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object