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


Java DirectedGraph.edgeSet方法代碼示例

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


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

示例1: intersect

import org.jgrapht.DirectedGraph; //導入方法依賴的package包/類
@Override
public DirectedGraph<Node, Triple> intersect(DirectedGraph<Node, Triple> baseGraph, DirectedGraph<Node, Triple> removalGraph) {
    DirectedGraph<Node, Triple> result = new DirectedSubgraph<>(baseGraph, removalGraph.vertexSet(), removalGraph.edgeSet());

    //Materialize the intersection
    //DirectedGraph<Node, Triple> tmp = createNew();
    //Graphs.addGraph(tmp, result);
    //result = tmp

    return result;
}
 
開發者ID:SmartDataAnalytics,項目名稱:SubgraphIsomorphismIndex,代碼行數:12,代碼來源:SetOpsJGraphTRdfJena.java

示例2: SSA

import org.jgrapht.DirectedGraph; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
protected SSA(DirectedGraph<V, E> graph, Dominators<V, E> dom) {
    if (!(graph instanceof CFG)) {
        throw new IllegalArgumentException();
    }
    this.cfg = (CFG) graph;
    this.dom = dom;
    this.domFrontier = dom.getDF();
    this.cdgTree = new SSAGraph<>();
    for (V v : graph.vertexSet()) {
        cdgTree.addVertex(v);
    }
    for (E e : graph.edgeSet()) {
        cdgTree.addEdge(graph.getEdgeSource(e), graph.getEdgeTarget(e));
    }
    this.cdgBlockTree = new SSABlockTree<>(this.cdgTree, dom.getStart());
    // gather variables
    discoverVariables();
    //this.count = new int[variables.size()];
    this.count = new HashMap<>(variables.size());
    this.stack = new HashMap<>(variables.size());
    // for each variable a
    for (int i : variables) {
        //count[i] = 0;
        count.put(i, 0);
        stack.put(i, new LinkedList<Integer>());
        stack.get(i).add(0); // push 0 onto Stack[a]
    }
}
 
開發者ID:DocGerd,項目名稱:DalvikSSA,代碼行數:30,代碼來源:SSA.java

示例3: shortestCycle

import org.jgrapht.DirectedGraph; //導入方法依賴的package包/類
private static List<String> shortestCycle(DirectedGraph<String, DefaultEdge> graph)
{
    FloydWarshallShortestPaths<String, DefaultEdge> floyd = new FloydWarshallShortestPaths<>(graph);
    int minDistance = Integer.MAX_VALUE;
    String minSource = null;
    String minDestination = null;
    for (DefaultEdge edge : graph.edgeSet()) {
        String src = graph.getEdgeSource(edge);
        String dst = graph.getEdgeTarget(edge);
        int dist = (int) Math.round(floyd.shortestDistance(dst, src)); // from dst to src
        if (dist < 0) {
            continue;
        }
        if (dist < minDistance) {
            minDistance = dist;
            minSource = src;
            minDestination = dst;
        }
    }
    if (minSource == null) {
        return null;
    }
    GraphPath<String, DefaultEdge> shortestPath = floyd.getShortestPath(minDestination, minSource);
    List<String> pathVertexList = Graphs.getPathVertexList(shortestPath);
    // note: pathVertexList will be [a, a] instead of [a] when the shortest path is a loop edge
    if (!Objects.equals(shortestPath.getStartVertex(), shortestPath.getEndVertex())) {
        pathVertexList.add(pathVertexList.get(0));
    }
    return pathVertexList;
}
 
開發者ID:y-lan,項目名稱:presto,代碼行數:31,代碼來源:SqlQueryQueueManager.java

示例4: removeSpecialEdges

import org.jgrapht.DirectedGraph; //導入方法依賴的package包/類
private DirectedGraph<AttributeRef, ExtendedEdge> removeSpecialEdges(DirectedGraph<AttributeRef, ExtendedEdge> faginDependencyGraph) {
    DirectedGraph<AttributeRef, ExtendedEdge> dependencyGraph = new DefaultDirectedGraph<AttributeRef, ExtendedEdge>(ExtendedEdge.class);
    if (faginDependencyGraph == null) {
        return dependencyGraph;
    }
    Graphs.addGraph(dependencyGraph, faginDependencyGraph);
    for (ExtendedEdge edge : faginDependencyGraph.edgeSet()) {
        if (edge.isSpecial() && !edge.isNormal()) {
            dependencyGraph.removeEdge(edge);
        }
    }
    return dependencyGraph;
}
 
開發者ID:donatellosantoro,項目名稱:Llunatic,代碼行數:14,代碼來源:AnalyzeDependencies.java

示例5: cloneGraph

import org.jgrapht.DirectedGraph; //導入方法依賴的package包/類
private static DirectedGraph<FunctionVertex, CallEdge> cloneGraph(DirectedGraph<FunctionVertex, CallEdge> g) {
    DirectedGraph<FunctionVertex, CallEdge> result;
    result = new DefaultDirectedGraph<>(CallEdge.class);

    List<FunctionVertex> list = new ArrayList<>();

    for (FunctionVertex v : g.vertexSet()) {
        FunctionVertex v2 = new FunctionVertex();
        v2.clone(v);
        list.add(v2);
        result.addVertex(v2);
    }

    list.indexOf(g);
    FunctionVertex src;
    FunctionVertex dst;
    for (CallEdge e : g.edgeSet()) {
        src = g.getEdgeSource(e);
        dst = g.getEdgeTarget(e);

        /* get clonned vertex */
        src = list.get(list.indexOf(src));
        dst = list.get(list.indexOf(dst));

        result.addEdge(src, dst, new CallEdge(e.type));
    }

    return result;
}
 
開發者ID:j123b567,項目名稱:stack-usage,代碼行數:30,代碼來源:CallGraph.java

示例6: printCallGraphDot

import org.jgrapht.DirectedGraph; //導入方法依賴的package包/類
public String printCallGraphDot(DirectedGraph<FunctionVertex, CallEdge> g) {
    StringBuilder sb = new StringBuilder();

    String callerFile = "";
    int i = 0;

    sb.append("digraph callgraph {\n");

    for (FunctionVertex fn : g.vertexSet()) {
        if (!callerFile.equals(fn.file)) {
            if (!callerFile.isEmpty()) {
                sb.append("\t\tlabel=\"").append(callerFile).append("\"\n");
                sb.append("\t}\n\n");
            }
            callerFile = fn.file;
            sb.append("\tsubgraph cluster_").append(i++).append(" {\n");
        }

        sb.append("\t\t\"");
        sb.append(fn);
        sb.append("\"");
        sb.append(";\n");
    }

    if (!callerFile.isEmpty()) {
        sb.append("\t\tlabel=\"").append(callerFile).append("\"\n");
        sb.append("\t}\n\n");
    }


    for (CallEdge ce : g.edgeSet()) {
        sb.append("\t\"");
        sb.append(g.getEdgeSource(ce));
        sb.append("\"");
        sb.append(" -> ");
        sb.append("\"");
        sb.append(g.getEdgeTarget(ce));
        sb.append("\"");
        sb.append(";\n");
    }
    sb.append("}\n");

    return sb.toString();
}
 
開發者ID:j123b567,項目名稱:stack-usage,代碼行數:45,代碼來源:CallGraph.java


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