Given a set of properties and their relationships, build a graph and answer reachability or grouping-style queries over it.
You are given a collection of properties and relationships between them. Model the properties as nodes in a graph, where each relationship connects two properties that are related.
Your task is to process the graph and determine the required result for the problem, such as whether properties are connected, how they should be grouped, or what values can be inferred by traversing the relationships.
Because the exact query format is not available from the source metadata, treat this as a graph-processing problem centered on building adjacency information and exploring connectivity efficiently.
The exact input shape is not available from the metadata, so the problem should be understood as a graph construction and traversal task.
Use a graph traversal or lookup-based approach consistent with the relationships provided.
Example 1
Input
Properties: [A, B, C, D] Relationships: [(A, B), (B, C)] Query: Are A and C connected?
Output
true
Explanation
A is connected to B, and B is connected to C, so A and C belong to the same connected component.
Example 2
Input
Properties: [A, B, C, D] Relationships: [(A, B), (C, D)] Query: How many connected groups exist?
Output
2
Explanation
There are two disconnected components: {A, B} and {C, D}.
Premium problem context
Premium adds guided hints, editorial links, similar variants, discussion resources, and concept maps so you can understand why a problem matters, not just solve it once.