public BreadthFirstIterator(Node startNode, boolean directed) { this.directed = directed; graph = startNode.getGraph(); int n = graph.getNodeCount(); queue = new Node[n]; depth = new int[n]; int s = startNode.getIndex(); for (int i = 0; i < n; i++) depth[i] = i == s ? 0 : -1; queue[0] = startNode; qHead = 0; qTail = 1; }
@SuppressWarnings("unchecked") public DepthFirstIterator(Node startNode, boolean directed) { this.directed = directed; graph = startNode.getGraph(); int n = graph.getNodeCount(); parent = new Node[n]; iterator = new Iterator[n]; depth = new int[n]; int s = startNode.getIndex(); for (int i = 0; i < n; i++) depth[i] = i == s ? 0 : -1; next = startNode; }
@SuppressWarnings("unchecked") public DepthFirstIterator(Node startNode, boolean directed) { this.directed = directed; graph = startNode.getGraph(); int n = graph.getNodeCount(); parent = new Node[n]; iterator = new Iterator[n]; depth = new int[n]; int s = startNode.getIndex(); for (int i = 0; i < n; i++) depth[i] = i == s ? 0 : -1; next = startNode; }
public BreadthFirstIterator(Node startNode, boolean directed) { this.directed = directed; graph = startNode.getGraph(); int n = graph.getNodeCount(); queue = new Node[n]; depth = new int[n]; int s = startNode.getIndex(); for (int i = 0; i < n; i++) depth[i] = i == s ? 0 : -1; queue[0] = startNode; qHead = 0; qTail = 1; }