A `Predicate` tests whether an `Object` satisfies a specific implementation-defined property. Predicates may be logically combined using such Jakarta-defined predicates as `AndPredicate` (which returns true if all input predicates return true). JUNG uses `Predicates` (found in the `graph.predicates` package) for the following tasks:

defining constraints on edges and vertices added to a graph (=> graphs that only allow vertices with (one of) a (set of) specified decoration(s), or that only allow directed edges)
defining/creating edge and vertex subsets (create a subset of all vertices with label "student")
general testing for properties of edges, vertices, and graphs (is this graph connected?)

Note: Some predicates are unsuitable for use as constraints (and some predicates are only suitable for use as constraints). We have tried to make these distinctions clear in the documentation for each predicate. Users are advised to read the documentation for a predicate before using it. Some general rules for which predicates are appropriate in different circumstances:

Vertex constraints should be (logical combinations of) `VertexPredicate`.
Edge constraints should be (logical combinations of) `EdgePredicate`.
`GraphPredicates` are not appropriate for use as vertex or edge constraints, or for defining vertex/edge subsets.
Some predicates specify that they are intended for use only on orphaned vertices/edges (those that have not yet been added to a graph). These are only suitable for use as constraints.
Predicates that only check for non-structural attributes (e.g., decorations or other metadata) of vertices or edges are suitable for general use (constraint definition, subset specification, etc.).

However, constraints and subset specifications are only checked once: when the element is added to the graph. If a graph element's attribute is mutable, and changes after it is added to a graph (or a cached subset managed by `SubsetManager`) such that it no longer passes a constraint (belongs in a subset), JUNG will not throw an exception, nor will it automatically remove the graph element from the graph (subset).
Users who wish to update their graphs/subsets in response to such changes may wish to create a listener that is notified of changes to relevant attributes.

Only vertex constraints are checked when a vertex is added, and only edge constraints are checked when an edge is added. Therefore, predicates that check for structural properties (for example, the degree of a vertex) are not suitable for use as constraints.

JUNG `Predicates` that do not take constructor arguments are accessed via a static `getInstance` call; other `Predicates` are created with the usual constructor call.

For more information on `Predicates` and their use, see the commons-collections website.