• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java VertexPredicateFilter类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中edu.uci.ics.jung.algorithms.filters.VertexPredicateFilter的典型用法代码示例。如果您正苦于以下问题:Java VertexPredicateFilter类的具体用法?Java VertexPredicateFilter怎么用?Java VertexPredicateFilter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



VertexPredicateFilter类属于edu.uci.ics.jung.algorithms.filters包,在下文中一共展示了VertexPredicateFilter类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: filter

import edu.uci.ics.jung.algorithms.filters.VertexPredicateFilter; //导入依赖的package包/类
public static  <V, E> Graph<V, E> filter(Graph<V, E> graph, final Collection<V> vertices) {
	
	Predicate<V> predicate = new Predicate<V>() {
		@Override
		public boolean evaluate(V vertex) {
			if(vertices.contains(vertex))
				return true;
		
			return false;
		}
	};

	//Filter graph
	Filter<V, E> verticesFilter = new VertexPredicateFilter<V, E>(predicate);
	graph = verticesFilter.transform(graph);

	return graph;
}
 
开发者ID:MKLab-ITI,项目名称:mgraph-summarization,代码行数:19,代码来源:GraphUtils.java


示例2: transformCurrentGraph

import edu.uci.ics.jung.algorithms.filters.VertexPredicateFilter; //导入依赖的package包/类
private G transformCurrentGraph(final FilterType filter, Map<String, DataMatcher> matcherMap, final Integer hops, final Set<String> pickedVertexes){
    final Map<String, GraphMLMetadata<String>> edgeMetadatas1 = graphmlLoader.getEdgeMetadatas();
    EdgePredicateFilter<String, String> edgeFilter = EdgeFilterFactory.createEdgeFilter(filter, matcherMap,edgeMetadatas1);
    final Graph<String, String> graph1 = edgeFilter.transform(currentGraph);

    VertexPredicateFilter<String, String> filterV = VertexFilterFactory.createVertexFilter(filter,matcherMap ,graphmlLoader.getVertexMetadatas(), graph1);

    G graph2 = (G) filterV.transform(graph1);
    HashSet<String> set = new HashSet<String>(graph2.getVertices());
    if (pickedVertexes != null) {
        if (pickedVertexes.size() != 0) {
            set.retainAll(pickedVertexes);
        }
    }
    KNeighborhoodFilter<String, String> f = new KNeighborhoodFilter<String, String>(set, hops, KNeighborhoodFilter.EdgeType.IN_OUT);
    return (G) f.transform(graph2);
}
 
开发者ID:iTransformers,项目名称:netTransformer,代码行数:18,代码来源:GraphViewerPanel.java


示例3: TacticVertexFilter

import edu.uci.ics.jung.algorithms.filters.VertexPredicateFilter; //导入依赖的package包/类
/*******************************************************
 * Constructor.
 * 
 * @param tactic
 *            The {@link TreeQualityItem} that represents a tactic.
 *******************************************************/
public TacticVertexFilter(final TreeQualityItem tactic)
{
	mFilter = new VertexPredicateFilter<ICompilationUnit, EdgeWrapper>(new Predicate<ICompilationUnit>()
	{
		private final TreeQualityItem mTactic = tactic;

		/*******************************************************
		 * This predicate will determine whether to include the vertex in
		 * the filtered graph or not.
		 * 
		 * @param vertex
		 *            The vertex currently being processed
		 * @return ture if the vertex to be included in the filtered graph,
		 *         false otherwise.
		 *******************************************************/
		@Override
		public boolean evaluate(ICompilationUnit vertex)
		{
			boolean result = false;

			String fullPath = new File(vertex.getResource().getLocationURI()).getAbsolutePath();
			
			if (mTactic.containsFile(fullPath))
			{
				result = true;
			}

			return result;
		}
	});
}
 
开发者ID:ArchieProject,项目名称:Archie-Smart-IDE,代码行数:38,代码来源:TacticVertexFilter.java


示例4: getGenericNubiSaveComponentByName

import edu.uci.ics.jung.algorithms.filters.VertexPredicateFilter; //导入依赖的package包/类
private GenericNubiSaveComponent getGenericNubiSaveComponentByName(final String name) {
    Graph<AbstractNubisaveComponent, Object> nubisaveComponentGraph = new VertexPredicateFilter(new Predicate() {
        @Override
        public boolean evaluate(Object vertex) {
            return vertex instanceof GenericNubiSaveComponent &&
                    ((GenericNubiSaveComponent)vertex).getUniqueName().equals(name);
        }
    }).transform(graph);
    if(! nubisaveComponentGraph.getVertices().iterator().hasNext() ){
        return null;
    }
    return (GenericNubiSaveComponent)nubisaveComponentGraph.getVertices().iterator().next();
}
 
开发者ID:joe42,项目名称:nubisave,代码行数:14,代码来源:JNotifyConfigUpdater.java


示例5: findNodesToCondense

import edu.uci.ics.jung.algorithms.filters.VertexPredicateFilter; //导入依赖的package包/类
public static DirectedGraph<SEMOSSVertex, SEMOSSEdge>
		condense( DirectedGraph<SEMOSSVertex, SEMOSSEdge> graph,
				URI toremove, URI endpoint, EdgePropertySource strat ) {

	MultiMap<SEMOSSVertex, CondenserTuple> triples
			= findNodesToCondense( graph, toremove, endpoint );

	final VertexPredicateFilter<SEMOSSVertex, SEMOSSEdge> nomiddles
			= new VertexPredicateFilter<>( new Predicate<SEMOSSVertex>() {

				@Override
				public boolean apply( SEMOSSVertex input ) {
					return !triples.containsKey( input );
				}
			} );

	DirectedGraph<SEMOSSVertex, SEMOSSEdge> newgraph
			= (DirectedGraph<SEMOSSVertex, SEMOSSEdge>) nomiddles.apply( graph );

	// finally, makes the new edges from the condensed nodes
	for ( Map.Entry<SEMOSSVertex, List<CondenserTuple>> en : triples.entrySet() ) {
		SEMOSSVertex middle = en.getKey();

		for ( CondenserTuple tup : en.getValue() ) {
			SEMOSSVertex from = graph.getSource( tup.in );
			SEMOSSVertex to = graph.getDest( tup.out );

			SEMOSSEdge edge = new SEMOSSEdgeImpl( middle.getURI() );

			Map<URI, Value> props;
			switch ( strat ) {
				case NODE:
					props = middle.getValues();
					break;
				case INEDGE:
					props = tup.in.getValues();
					break;
				case OUTEDGE:
					props = tup.out.getValues();
					break;
				default:
					throw new IllegalArgumentException( "no edge property source provided!" );
			}

			for ( Map.Entry<URI, Value> prop : props.entrySet() ) {
				edge.setValue( prop.getKey(), prop.getValue() );
			}
			edge.setType( middle.getType() );

			newgraph.addEdge( edge, from, to, EdgeType.DIRECTED );
		}
	}

	return newgraph;
}
 
开发者ID:Ostrich-Emulators,项目名称:semtool,代码行数:56,代码来源:CondenseGraph.java



注:本文中的edu.uci.ics.jung.algorithms.filters.VertexPredicateFilter类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java IndexReaderWarmer类代码示例发布时间:2022-05-23
下一篇:
Java TabListItem类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap