本文整理汇总了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;未经允许,请勿转载。 |
请发表评论