當前位置: 首頁>>代碼示例>>Java>>正文


Java DirectedGraph.incomingEdgesOf方法代碼示例

本文整理匯總了Java中org.jgrapht.DirectedGraph.incomingEdgesOf方法的典型用法代碼示例。如果您正苦於以下問題:Java DirectedGraph.incomingEdgesOf方法的具體用法?Java DirectedGraph.incomingEdgesOf怎麽用?Java DirectedGraph.incomingEdgesOf使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.jgrapht.DirectedGraph的用法示例。


在下文中一共展示了DirectedGraph.incomingEdgesOf方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: replaceVertex

import org.jgrapht.DirectedGraph; //導入方法依賴的package包/類
private static void replaceVertex(DirectedGraph<IAtomicDerivedStateProcessor<? extends EObject>, DefaultEdge> graph,
        IAtomicDerivedStateProcessor<? extends EObject> original,
        IAtomicDerivedStateProcessor<? extends EObject> replacement) {

    Collection<DefaultEdge> edgeDump = new ArrayList<>();

    for (DefaultEdge incomingEdge : graph.incomingEdgesOf(original)) {
        IAtomicDerivedStateProcessor<? extends EObject> edgeSource = graph.getEdgeSource(incomingEdge);
        edgeDump.add(incomingEdge);
        graph.addEdge(edgeSource, replacement);
    }

    for (DefaultEdge outgoingEdge : graph.outgoingEdgesOf(original)) {
        // we do not insert the dependencies of the removed vertex because the new vertex has its own dependencies
        edgeDump.add(outgoingEdge);
    }

    edgeDump.forEach(graph::removeEdge);
    graph.removeVertex(original);
}
 
開發者ID:Cooperate-Project,項目名稱:CooperateModelingEnvironment,代碼行數:21,代碼來源:DerivedStateProcessor.java

示例2: getDomainLinksInLabeledGraph

import org.jgrapht.DirectedGraph; //導入方法依賴的package包/類
public static Set<LabeledLink> getDomainLinksInLabeledGraph(DirectedGraph<Node, LabeledLink> g, ColumnNode n) {
	
	Set<LabeledLink> domainLinks = new HashSet<LabeledLink>();
	if (g == null || 
			n == null || 
			!g.vertexSet().contains(n))
		return domainLinks;
	
	Set<LabeledLink> incomingLinks = g.incomingEdgesOf(n);
	if (incomingLinks != null) {
		for (DefaultLink l : incomingLinks) {
			domainLinks.add((LabeledLink)l);
		}
	}
	
	return domainLinks;
}
 
開發者ID:therelaxist,項目名稱:spring-usc,代碼行數:18,代碼來源:GraphUtil.java

示例3: getDomainLinksInDefaultGraph

import org.jgrapht.DirectedGraph; //導入方法依賴的package包/類
public static Set<LabeledLink> getDomainLinksInDefaultGraph(DirectedGraph<Node, DefaultLink> g, ColumnNode n) {
	
	Set<LabeledLink> domainLinks = new HashSet<LabeledLink>();
	if (g == null || 
			n == null || 
			!g.vertexSet().contains(n))
		return domainLinks;
	
	Set<DefaultLink> incomingLinks = g.incomingEdgesOf(n);
	if (incomingLinks != null) {
		for (DefaultLink l : incomingLinks) {
			if (l instanceof LabeledLink)
				domainLinks.add((LabeledLink)l);
		}
	}
	
	return domainLinks;
}
 
開發者ID:therelaxist,項目名稱:spring-usc,代碼行數:19,代碼來源:GraphUtil.java

示例4: getDomainLinks

import org.jgrapht.DirectedGraph; //導入方法依賴的package包/類
public static HashMap<SemanticType, LabeledLink> getDomainLinks(DirectedGraph<Node, DefaultLink> g, ColumnNode n, List<SemanticType> semanticTypes) {
	
	HashMap<SemanticType, LabeledLink> domainLinks = new HashMap<SemanticType, LabeledLink>();
	if (g == null || 
			n == null || 
			semanticTypes == null ||
			!g.vertexSet().contains(n))
		return domainLinks;
	
	Set<DefaultLink> incomingLinks = g.incomingEdgesOf(n);
	if (incomingLinks != null) {
		for (SemanticType st : semanticTypes) {
			for (DefaultLink l : incomingLinks) {
				if (st.getDomain().getUri().equalsIgnoreCase(l.getSource().getUri()) &&
						st.getType().getUri().equalsIgnoreCase(l.getUri())) {
					if (l instanceof LabeledLink)
						domainLinks.put(st, (LabeledLink)l);
				}
			}
		}
	}
	
	return domainLinks;
}
 
開發者ID:therelaxist,項目名稱:spring-usc,代碼行數:25,代碼來源:GraphUtil.java

示例5: getParents

import org.jgrapht.DirectedGraph; //導入方法依賴的package包/類
/**
 * Assumes edge contains an index
 */
public static <T> List<T> getParents(DirectedGraph g, T n) {
    List<IndexedEdge> incoming = new ArrayList(g.incomingEdgesOf(n));
    Collections.sort(incoming);
    List<T> ret = new ArrayList();
    for(IndexedEdge e: incoming) {
        ret.add((T)e.source);
    }        
    return ret;
}
 
開發者ID:zhangjunfang,項目名稱:jstorm-0.9.6.3-,代碼行數:13,代碼來源:TridentUtils.java

示例6: getInNeighbors

import org.jgrapht.DirectedGraph; //導入方法依賴的package包/類
public static Set<Node> getInNeighbors(DirectedGraph<Node, DefaultLink> g, Node n) {
	
	Set<Node> neighbors = new HashSet<Node>();
	if (g == null || n == null || !g.vertexSet().contains(n))
		return neighbors;
	
	Set<DefaultLink> incomingLinks = g.incomingEdgesOf(n);
	if (incomingLinks != null) {
		for (DefaultLink l : incomingLinks) {
			neighbors.add(l.getSource());
		}
	}
	
	return neighbors;
}
 
開發者ID:therelaxist,項目名稱:spring-usc,代碼行數:16,代碼來源:GraphUtil.java

示例7: allPreviousStrataAreSatisfied

import org.jgrapht.DirectedGraph; //導入方法依賴的package包/類
private boolean allPreviousStrataAreSatisfied(TGDStratum tgdStratum) {
    this.unsatisfiedStrataLock.lock();
    try {
        DirectedGraph<TGDStratum, DefaultEdge> strataGraph = scenario.getStratification().getTgdStrataGraph();
        for (DefaultEdge inEdge : strataGraph.incomingEdgesOf(tgdStratum)) {
            TGDStratum prevStratum = strataGraph.getEdgeSource(inEdge);
            if (unsatisfiedStrata.contains(prevStratum)) {
                return false;
            }
        }
        return true;
    } finally {
        this.unsatisfiedStrataLock.unlock();
    }
}
 
開發者ID:donatellosantoro,項目名稱:Llunatic,代碼行數:16,代碼來源:ScheduleTGDStrata.java

示例8: allPreviousStrataAreSatisfied

import org.jgrapht.DirectedGraph; //導入方法依賴的package包/類
private boolean allPreviousStrataAreSatisfied(EGDStratum egdStratum) {
    this.unsatisfiedStrataLock.lock();
    try {
        DirectedGraph<EGDStratum, DefaultEdge> strataGraph = scenario.getStratification().getEgdStrataGraph();
        for (DefaultEdge inEdge : strataGraph.incomingEdgesOf(egdStratum)) {
            EGDStratum prevStratum = strataGraph.getEdgeSource(inEdge);
            if (unsatisfiedStrata.contains(prevStratum)) {
                return false;
            }
        }
        return true;
    } finally {
        this.unsatisfiedStrataLock.unlock();
    }
}
 
開發者ID:donatellosantoro,項目名稱:Llunatic,代碼行數:16,代碼來源:ScheduleEGDStrata.java

示例9: excludeInfoVertex

import org.jgrapht.DirectedGraph; //導入方法依賴的package包/類
private void excludeInfoVertex(final InfoVertex<T, C> vertex) {
	Validate.notNull(vertex);
	logger.trace(MessageFormat.format("Excluding [{0}].", vertex));

	final DirectedGraph<InfoVertex<T, C>, DependencyEdge> graph = analyzer
			.getGraph();

	final SortedMap<ContainmentType, Deque<InfoVertex<T, C>>> deques = new TreeMap<ContainmentType, Deque<InfoVertex<T, C>>>();
	deques.put(ContainmentType.EXCLUDED_EXPLICITLY,
			new LinkedList<InfoVertex<T, C>>());
	deques.put(ContainmentType.EXCLUDED_AS_HARD_DEPENDENCY,
			new LinkedList<InfoVertex<T, C>>());
	deques.get(ContainmentType.EXCLUDED_EXPLICITLY).add(vertex);

	for (Map.Entry<ContainmentType, Deque<InfoVertex<T, C>>> dequeEntry : deques
			.entrySet()) {
		final ContainmentType dequeContainmentType = dequeEntry.getKey();
		final Deque<InfoVertex<T, C>> deque = dequeEntry.getValue();
		while (!deque.isEmpty()) {
			final InfoVertex<T, C> targetVertex = deque.removeFirst();

			final ContainmentType currentTargetContainmentType = getInfoVertexContainmentType(targetVertex);
			final ContainmentType targetContainmentType = dequeContainmentType
					.combineWith(currentTargetContainmentType);

			if (currentTargetContainmentType == null
					|| currentTargetContainmentType
							.compareTo(targetContainmentType) > 0) {

				logger.trace(MessageFormat
						.format("Excluding the vertex [{0}] with the containment type [{1}].",
								targetVertex, targetContainmentType));

				setInfoVertexContainmentType(targetVertex,
						targetContainmentType);

				final Set<DependencyEdge> edges = graph
						.incomingEdgesOf(targetVertex);
				for (DependencyEdge edge : edges) {
					final InfoVertex<T, C> sourceVertex = graph
							.getEdgeSource(edge);
					final DependencyType dependencyType = edge.getType();
					final ContainmentType sourceContainmentType = dependencyType
							.combineWith(targetContainmentType);
					if (sourceContainmentType != null) {
						final Deque<InfoVertex<T, C>> sourceDeque = deques
								.get(sourceContainmentType);
						if (sourceDeque != null) {
							logger.trace(MessageFormat
									.format("Queueing the exclusion of the vertex [{0}] with the containment type [{1}].",
											sourceVertex,
											sourceContainmentType));
							sourceDeque.add(sourceVertex);
						}
					}
				}
			} else {
				logger.trace(MessageFormat
						.format("Vertex [{0}] is already excluded with the containment type [{1}].",
								targetVertex, targetContainmentType));
			}
		}
	}
}
 
開發者ID:highsource,項目名稱:jsonix-schema-compiler,代碼行數:65,代碼來源:Mapping.java


注:本文中的org.jgrapht.DirectedGraph.incomingEdgesOf方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。