edu.uci.ics.jung.graph.filters
Interface EfficientFilter

All Superinterfaces:
Filter
All Known Implementing Classes:
AlphabeticVertexFilter, SerialFilter, TrivialFilter, WeightedEdgeGraphFilter

public interface EfficientFilter
extends Filter

An EfficientFilter can take in an UnassembledGraph withut assembling it, and is used for non-structural filters. In general, EfficientFilters are those that look at vertices on their own, based on their attributes, as opposed to examining their structure.

This is an efficiency measure for handling streams of filters. Sometimes, a program needs to run a series of filters--for example, to cut out all vertices with field "color" is "green" and field "size" is "large". Rather than creating one custom filter that checks both, one can run those two filters serially. The code might look something like this:

 		Filter f_1 = new ColorFilter( "green" );
 		Filter f_2 = new SizeFilter( "large ");
 		Graph green_graph = f_1.filter( graph ).assemble();
 		Graph large_green_graph = f_2.filter( green_graph ).assemble()
 
Unfortunately, assembly can be an expensive process--it requires a full pass through the graph, checking each vertex and each edge. The EfficientFilter takes this into account and lets a user specify the faster parts:
 		EfficientFilter f_1 = new ColorFilter( "green" );
 		EfficientFilter f_2 = new SizeFilter( "large ");
 		UnassembledGraph green_u_graph = f_1.filter( graph ); // note: no call to assemble
 		Graph large_green_graph = f_2.filter( green_u_graph ).assemble()
 
which can be simplified to a chain as
 		EfficientFilter f_1 = new ColorFilter( "green" );
 		EfficientFilter f_2 = new SizeFilter( "large ");
 		Graph large_green_graph = f_2.filter( f_1.filter( graph )).assemble(); // note: no call to assemble
 

Filters that can safely use EfficientFilters.

An EfficientFilter should judge vertices and edges only on their UserData: information like labels, weights, and sizes. Because the vertices that an EfficientFilter takes in from its UnassembledGraph are not correctly linked into a graph, information like the vertex degree and vertex neighbors are likely to be inaccurate. Thus, the DropSoloNodesFilter does not implement EfficientFilter, because it examines the degree of each vertex.

This is taken into consideration correctly for SerialFilter.

Author:
danyelf

Method Summary
 UnassembledGraph filter(UnassembledGraph ug)
          Filters a graph by returning an UnassembledGraph consisting of nodes and edges that pass the filter.
 
Methods inherited from interface edu.uci.ics.jung.graph.filters.Filter
filter, getName
 

Method Detail

filter

public UnassembledGraph filter(UnassembledGraph ug)
Filters a graph by returning an UnassembledGraph consisting of nodes and edges that pass the filter. Note that this method must be implemented in addition to the methods in Filter.

Parameters:
ug - An unassembled graph to be filtered.
Returns:
an UnassembledGraph that contains the subset of vertices and edges from ug pass the filter.