当前位置: 首页>>代码示例>>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;未经允许,请勿转载。