EdgeList.cc
/**
 * Return a list of vertices for which predicate evaluates to true.
 * The vertices are not cloned, they are linked in the new list.
 * The list is a new list.
 */
Return a list of vertices for which predicate evaluates to true.
The vertices are not cloned, they are linked in the new list.
The list is a new list.
Return a list of vertices for which predicate evaluates to true . The vertices are not cloned they are linked in the new list . The list is a new list .
EdgeList *
EdgeList::filter( EdgePredicate *predicate ) {
    EdgeList *dot = this;
    if ( dot == NULL ) return NULL;
    if ( dot->next == NULL ) {
        if ( predicate(dot->edge) == false ) return NULL;
        return new EdgeList( dot->edge );
    }
    EdgeList *that = dot->next->filter( predicate );
    if ( predicate(dot->edge) == false ) return that;
    return new EdgeList( dot->edge, that );
}
EdgeList * EdgeList :: filter ( EdgePredicate * predicate ) { EdgeList * dot = this ; if ( dot == NULL ) return NULL ; if ( dot -> next == NULL ) { if ( predicate ( dot -> edge ) == false ) return NULL ; return new EdgeList ( dot -> edge ) ; } EdgeList * that = dot -> next -> filter ( predicate ) ; if ( predicate ( dot -> edge ) == false ) return that ; return new EdgeList ( dot -> edge , that ) ; }
Return a list of vertices for which predicate evaluates to true.
Return a list of vertices for which predicate evaluates to true .