Untitled
unknown
java
7 months ago
526 B
0
Indexable
Never
package LAB9; import java.util.ArrayList; import java.util.List; public class GraphNode { char label; List<GraphEdge> edgeList; // Constructor public GraphNode(char label) { this.label = label; this.edgeList = new ArrayList<>(); } // Add an edge to the node public void addEdge(GraphEdge edge) { // Only add the edge if the 'to' node is not the same as the current node if (edge.toNode != this) { edgeList.add(edge); } } }