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

ai.libs.jaicore.search.structure.graphgenerator.SubGraphGenerator Maven / Gradle / Ivy

package ai.libs.jaicore.search.structure.graphgenerator;

import org.api4.java.datastructure.graph.implicit.IGraphGenerator;
import org.api4.java.datastructure.graph.implicit.ISingleRootGenerator;
import org.api4.java.datastructure.graph.implicit.ISuccessorGenerator;

/**
 * This is a graph generator that takes another graph generator and generates its sub-graph under a given root node
 *
 * @author fmohr
 *
 * @param 
 * @param 
 */
public class SubGraphGenerator implements IGraphGenerator {

	private final IGraphGenerator actualGraphGenerator;
	private final N newRoot;

	public SubGraphGenerator(final IGraphGenerator actualGraphGenerator, final N newRoot) {
		super();
		this.actualGraphGenerator = actualGraphGenerator;
		this.newRoot = newRoot;
	}

	@Override
	public ISingleRootGenerator getRootGenerator() {
		return () -> this.newRoot;
	}

	@Override
	public ISuccessorGenerator getSuccessorGenerator() {
		return this.actualGraphGenerator.getSuccessorGenerator();
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy