当前位置: 首页>>代码示例>>Java>>正文


Java Graphs.predecessorListOf方法代码示例

本文整理汇总了Java中org.jgrapht.Graphs.predecessorListOf方法的典型用法代码示例。如果您正苦于以下问题:Java Graphs.predecessorListOf方法的具体用法?Java Graphs.predecessorListOf怎么用?Java Graphs.predecessorListOf使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jgrapht.Graphs的用法示例。


在下文中一共展示了Graphs.predecessorListOf方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getBoundVariables

import org.jgrapht.Graphs; //导入方法依赖的package包/类
public Set<IVariable> getBoundVariables(final ILiteral literal) {
	if (literal == null) {
		throw new IllegalArgumentException("The literal must not be null");
	}

	if (!sipGraph.containsVertex(literal)) {
		return Collections.<IVariable>emptySet();
	}

	final Set<IVariable> variables = new HashSet<IVariable>();

	for (final ILiteral predicate : Graphs.predecessorListOf(sipGraph, literal)) {
		variables.addAll(sipGraph.getEdge(predicate, literal).getLabel());
	}
	return variables;
}
 
开发者ID:NICTA,项目名称:iris-reasoner,代码行数:17,代码来源:LeftToRightSip.java

示例2: getDepends

import org.jgrapht.Graphs; //导入方法依赖的package包/类
public Set<ILiteral> getDepends(final ILiteral literal) {
	final Set<ILiteral> dependencies = new HashSet<ILiteral>();
	final Set<ILiteral> todoDependencies = new HashSet<ILiteral>();
	if (literal == null) {
		throw new IllegalArgumentException("The literal must not be null");
	}

	if (!sipGraph.containsVertex(literal)) {
		return Collections.<ILiteral>emptySet();
	}

	todoDependencies.add(literal);
	while (!todoDependencies.isEmpty()) {
		final ILiteral actual = todoDependencies.iterator().next();
		todoDependencies.remove(actual);

		for (final ILiteral vertex : Graphs.predecessorListOf(sipGraph, actual)) {
			if (dependencies.add(vertex)) {
				todoDependencies.add(vertex);
			}
		}
	}

	return dependencies;
}
 
开发者ID:NICTA,项目名称:iris-reasoner,代码行数:26,代码来源:LeftToRightSip.java

示例3: getEdgesEnteringLiteral

import org.jgrapht.Graphs; //导入方法依赖的package包/类
public Set<LabeledEdge<ILiteral, Set<IVariable>>> getEdgesEnteringLiteral(
		final ILiteral literal) {
	if (literal == null) {
		throw new IllegalArgumentException("The literal must not be null");
	}

	if (!sipGraph.containsVertex(literal)) {
		return Collections.<LabeledEdge<ILiteral, Set<IVariable>>>emptySet();
	}

	final List<ILiteral> predecessors = Graphs.predecessorListOf(sipGraph, literal);
	final Set<LabeledEdge<ILiteral, Set<IVariable>>> edges = 
		new HashSet<LabeledEdge<ILiteral, Set<IVariable>>>(predecessors.size());
	for (final ILiteral predecessor : predecessors) {
		edges.add(sipGraph.getEdge(predecessor, literal));
	}
	return edges;
}
 
开发者ID:NICTA,项目名称:iris-reasoner,代码行数:19,代码来源:LeftToRightSip.java

示例4: getDepends

import org.jgrapht.Graphs; //导入方法依赖的package包/类
public Set<IPredicate> getDepends(final IPredicate p) {
	if (p == null) {
		throw new NullPointerException("The predicate must not be null");
	}
	if (!g.containsVertex(p)) {
		return Collections.EMPTY_SET;
	}

	final Set<IPredicate> todo = new HashSet<IPredicate>();
	todo.add(p);
	final Set<IPredicate> deps = new HashSet<IPredicate>();

	while (!todo.isEmpty()) {
		final IPredicate act = todo.iterator().next();
		todo.remove(act);

		for (final IPredicate depends : Graphs.predecessorListOf(g, act)) {
			if (deps.add(depends)) {
				todo.add(depends);
			}
		}
	}

	return deps;
}
 
开发者ID:NICTA,项目名称:iris-reasoner,代码行数:26,代码来源:PredicateGraph.java

示例5: directImportersOf

import org.jgrapht.Graphs; //导入方法依赖的package包/类
/**
 * @see msi.gama.lang.gaml.indexer.IModelIndexer#directImportersOf(org.eclipse.emf.common.util.URI)
 */
public static Set<URI> directImportersOf(final URI uri) {
	final URI newURI = GamlResourceServices.properlyEncodedURI(uri);
	if (index.containsVertex(newURI))
		return new HashSet(Graphs.predecessorListOf(index, newURI));
	return Collections.EMPTY_SET;
}
 
开发者ID:gama-platform,项目名称:gama,代码行数:10,代码来源:GamlResourceIndexer.java


注:本文中的org.jgrapht.Graphs.predecessorListOf方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。