Many complex systems can be modeled as a graph consisting of nodes and connecting edges. Such a graph-based model is useful to study the resilience of decentralized systems that handle a system failure by isolating a subsystem with failed components. In this chapter, we study a graph clustering problem for electrical grids where a given grid is partitioned into multiple microgrids that are self-contained in terms of electricity balance. Our goal is to find an optimal partition that minimizes the cost of constructing a set of self-sufficient microgrids. To obtain a better solution accommodating smaller microgrids, we develop an efficient verification algorithm that determines whether microgrids can balance their electricity surplus through electricity exchange among them. Our experimental results with a dataset about Yokohama city in Japan show that our proposed method can effectively reduce the construction cost of decentralized microgrids.