All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.almondtools.util.graph.PostOrderTraversal Maven / Gradle / Ivy

Go to download

Regular expression matchers, searcher, lexers based on deterministic finite automata

There is a newer version: 0.3.3
Show newest version
package com.almondtools.util.graph;

import java.util.HashSet;
import java.util.Set;

public abstract class PostOrderTraversal extends AbstractTraversal implements Traversal {
	
	private Set> visited;
	
	public PostOrderTraversal(Graph graph) {
		super(graph);
		this.visited = new HashSet>();
	}

	@Override
	public void traverse() {
		super.traverse();
	}

	@Override
	public void traverseNode(GraphNode node) {
		if (!visited.contains(node)) {
			visited.add(node);
			for (GraphNode next : node.getSuccessors()) {
				next.apply(this);
			}
			visitGraphNode(node);
		}
	}

	
	public abstract void visitGraphNode(GraphNode node);

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy