Knowledge Graph Analysis of Legal Understanding and Violations in LLMs