Using materialized views for answering graph pattern queries