Sandwiching a densest subgraph by consecutive cores