|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
A Filter
returns a subgraph of a Graph
, in the
form of an UnsassembledGraph
. That UnsassembledGraph
can then be turned into a Graph
with a call to assemble()
.
A Filter
, then, selects the subset of vertices and edges and from them creates
an UnassembledGraph
(presumably, with one of its two constructors.)
An UnsassembledGraph
represents all the vertices (and at least all the edges) of
a Graph
that pass the subset. However, they have not been "assembled" into something
that fulfills the Graph
contract. (In particular, the Vertices
and
Edges
that make up
the UnassembledGraph
still report, through getGraph()
,
that they are members of the
original, and they still are connected to all the original edges.
After the call to assemble
, the new Graph
is valid , following the
Graph contract fully.
Graph g =At the end of this code, the new graphTestGraphs.createTestGraph
( true ); // creates a graph. EdgeWeightLabeller ewl =EdgeWeightLabeller.getLabeller( g );
// links each edge to a weight. WeightedEdgeGraphFilter wgf = newWeightedEdgeGraphFilter( 0, ewl )
; // creates a filter based on this weight wgf.setValue(3)
; // sets the threshold at 3. // at this point, the Filter is ready to block any edges with a weight less than 3.UnassembledGraph
ug =wgf.filter(g)
; // this UnassembledGraph contains all edges of weight greater than three, and all vertices in g Graph sub_g =ug.assemble()
;
sub_g
contains a copy of
some edges, and all nodes, of g
. From here, we can treat it as
a Graph
. Note that calls like
getEquivalentVertex( Graph )
will do the right thing on the vertices of sub_g
and point back to g
.
In addition, we now have access to the
that corresponds to the graph.
GraphAssemblyRecord
GraphAssemblyRecord gar = getAssemblyRecord( sub_g ); String filterName = gar.getName();
EfficientFilter
Method Summary | |
UnassembledGraph |
filter(Graph g)
Filters a graph by returning an UnassembledGraph consisting of nodes and edges that pass the filter. |
java.lang.String |
getName()
Gets a name that describes this filter. |
Method Detail |
public UnassembledGraph filter(Graph g)
g
- An input graph to be filtered.
public java.lang.String getName()
GraphAssemblyRecord
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |