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


Java SimpleDirectedGraph.outgoingEdgesOf方法代码示例

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


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

示例1: getParents

import org.jgrapht.graph.SimpleDirectedGraph; //导入方法依赖的package包/类
/**
 * Private utility to return the parents (direct ascendants) of a given child node.
 *
 * @param vertex contains node name and acts as cursor for current location.
 * @param graph  contains a reference to simple digraph {@code org.jgrapht.graph.SimpleDirectedGraph}.
 * @return Set of names that are parents of given child.
 */
static Set<String> getParents( String vertex, SimpleDirectedGraph<String, Relationship> graph )
{
    Set<String> parents = new HashSet<>();
    if ( graph == null )
    {
        // graph is null
        return null;
    }
    LOG.debug( "getParents [{}]", vertex);
    Set<Relationship> edges;
    try
    {
        edges = graph.outgoingEdgesOf( vertex );
    }
    catch ( java.lang.IllegalArgumentException iae )
    {
        // vertex is leaf.
        return null;
    }
    for ( Relationship edge : edges )
    {
        parents.add( edge.getParent() );
    }
    return parents;
}
 
开发者ID:apache,项目名称:directory-fortress-core,代码行数:33,代码来源:HierUtil.java

示例2: getAscendants

import org.jgrapht.graph.SimpleDirectedGraph; //导入方法依赖的package包/类
/**
 * Utility function recursively traverses a given digraph to build a set of all ascendant names.
 *
 * @param vertex     contains the position of the cursor for traversal of graph.
 * @param graph      contains a reference to simple digraph {@code org.jgrapht.graph.SimpleDirectedGraph}.
 * @param ascendants contains the result set of ascendant names.
 * @return value contains the vertex of current position.
 */
private static String getAscendants( Map<String, String> vertex, SimpleDirectedGraph<String, Relationship> graph,
    Set<String> ascendants )
{
    String v = vertex.get( VERTEX );
    if ( v == null )
    {
        return null;
    }
    else if ( graph == null )
    {
        return null;
    }
    LOG.debug( "getAscendants [{}]", v);
    Set<Relationship> edges;
    try
    {
        edges = graph.outgoingEdgesOf( v );

    }
    catch ( java.lang.IllegalArgumentException iae )
    {
        // vertex is leaf.
        return null;
    }
    for ( Relationship edge : edges )
    {
        vertex.put( VERTEX, edge.getParent() );
        ascendants.add( edge.getParent() );
        v = getAscendants( vertex, graph, ascendants );
    }
    return v;
}
 
开发者ID:apache,项目名称:directory-fortress-core,代码行数:41,代码来源:HierUtil.java

示例3: calculateExportedModules

import org.jgrapht.graph.SimpleDirectedGraph; //导入方法依赖的package包/类
private void calculateExportedModules() {
	SimpleDirectedGraph<ModuleModel, Edge> g = buildExportGraph();

	TransitiveClosure.INSTANCE.closeSimpleDirectedGraph(g);

	for (ModuleModel module : modules.values()) {
		module.allExportedModules.add(module);
		for (Edge e : g.outgoingEdgesOf(module)) {
			module.allExportedModules.add(g.getEdgeTarget(e));
		}
	}
}
 
开发者ID:ruediste,项目名称:jabsaw,代码行数:13,代码来源:ProjectModel.java

示例4: calculateModuleDependencies

import org.jgrapht.graph.SimpleDirectedGraph; //导入方法依赖的package包/类
private void calculateModuleDependencies() {
	SimpleDirectedGraph<ModuleModel, Edge> g = buildModuleDependencyGraph();

	TransitiveClosure.INSTANCE.closeSimpleDirectedGraph(g);

	for (ModuleModel module : modules.values()) {
		module.allModuleDependencies.add(module);
		for (Edge e : g.outgoingEdgesOf(module)) {
			module.allModuleDependencies.add(g.getEdgeTarget(e));
		}
	}
}
 
开发者ID:ruediste,项目名称:jabsaw,代码行数:13,代码来源:ProjectModel.java

示例5: getParents

import org.jgrapht.graph.SimpleDirectedGraph; //导入方法依赖的package包/类
/**
 * @param g
 */
private static String getParents(Map vertex, SimpleDirectedGraph<String, Relationship> g, List<String> parents)
{
    String v;
    //ReaderUtil.clearScreen();
    //System.out.println("addJGraph");
    //String vertex = "Max";
    v = (String) vertex.get("Vertex");
    if (g == null)
    {
        System.out.println("getAscendants simple directed graph is null");
        return null;
    }
    if (v == null)
    {
        System.out.println("getAscendants simple directed graph is null");
        return null;
    }
    System.out.println("getAscendants V [" + v + "]");

    Set<Relationship> edges = g.outgoingEdgesOf(v);
    for (Relationship edge : edges)
    {
        if (v == null)
            return null;
        else
        {
            System.out.println("Edge:" + edge);
            //parents.add(edge.toString());
            v = edge.toString();
            //Max : Super
            //getAscendants V <Super)>
            int indx = v.indexOf(GlobalIds.PROP_SEP);
            int indx2 = v.indexOf(')');
            if (indx >= 0)
            {
                v = v.substring(indx + 2, indx2);
            }

            //String parent =
            vertex.put("Vertex", v);
            if (!v.equalsIgnoreCase("Root"))
                parents.add(v);

            v = getParents(vertex, g, parents);
        }
    }
    return v;
}
 
开发者ID:apache,项目名称:directory-fortress-core,代码行数:52,代码来源:AdminMgrConsole.java


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