Cognitive maps are mental representations that allow the brain organize spatial and conceptual relationships between entities. Using these map-like representations, the brain can infer values for unlearned relationships within the same task context. However, it remains elusive how the brain leverages this structural knowledge to compute values for novel situations flexibly. We analyzed the representational geometry of relational structures as they responded to changing task contexts across brain areas in humans to examine how the brain constructs stable and generalizable representations while also determining context-specific decision values. Our findings show the ERC represents a global context-irrelevant space while simultaneously representing a low-dimensional context relevant rank code. Consistent with previous research, we found a context-specific and behaviorally relevant rank code in the mPFC. Additionally, we found that the associations learned from this structure led to efficient learning of new entities as predicted by cognitive map models and replication of ERC effects for a context-relevant rank code. We theorize the ERC plays a crucial role in abstracting relational information and supporting the representations in the mPFC for flexible decision-making.