The Invisible Architecture of the Vote: A Complex-Network Reading of Twenty Years of Municipal Elections in Ceará (2004–2024)
For more than a decade, I worked from inside the political apparatus of the state of Ceará. From participations in victorious political campaigns from 2008 to 2016, from the Legislative Assembly in the late 2000s, to the Casa Civil of the state government in the years that followed, during the 2013 protests and the 2014 World Cup, and finally to the Mayor’s Office of Fortaleza from 2015 to 2020. I sat in war rooms during campaigns, drafted communication strategies for candidates and administrations, and watched, up close, how parties and territories knitted together every four years. I really lived those electoral cycles. I did not study them from a distance. I was part of the seams.
A few years ago, I crossed over to the other side of the desk. I went back to academia, finished a master’s in Mathematical Modeling and Quantitative Methods at UFC, and started my Ph.D. in Economics at the Faculty of Economics of the University of Porto. The same cycles I had helped run as an operator I now look at as an object of study. The political life of Ceará between 2004 and 2024: six municipal elections, 71,977 candidacies, 46,258 unique people, 184 municipalities, is no longer my workplace. It is my dataset.
This post is about what I started to see when I looked at it that way. It is about an idea I have been refining for some time and which I am now able to formalize with complex networks: the existence of an invisible architecture of the vote, a structural skeleton that organizes municipal politics in the state and which becomes legible only when we stop looking at individual candidacies and start looking at the web of relations that contains them. This work was carried out under the guidance of Professor Leandro Chaves Rêgo, from the Department of Statistics and Applied Mathematics of the Federal University of Ceará.
The invisible architecture: a way of seeing
We usually read an election through its most visible outputs. Who won. Who lost. How many votes a party received. Which incumbent fell. Those numbers matter, of course, but they are only the surface of a much richer phenomenon. Beneath them lies a quieter layer that almost never makes it into the news: the infrastructure of relations that makes each candidacy possible in the first place. The party that contains it. The municipality that hosts it. The cycle in which it is registered. The other candidates who share that exact combination of party, place, and time. And, beyond a single election, the recurrence of those same people across cycles: the careers, the alliances, the migrations, the territorial loyalties.
I have come to call this layer the invisible architecture of the vote. It is invisible not because it is hidden by anyone in particular, but because the tools we use to look at politics are usually not designed to make it visible. Vote counts, polls, even sentiment analyses like the one I built for the 2024 Fortaleza election, all live on the surface of campaigns. They tell us what happened. They do not tell us on what structure it happened.
Complex networks, the same mathematical framework that maps gene regulation, citation systems, and the world wide web, give us a way to see that structure. Each candidate becomes a node. Each shared political-electoral context becomes a link. Apply this systematically to two decades of municipal elections in Ceará, and a vast object emerges: a graph with 46,258 individuals and 495,393 links. Of those individuals, 43,551, roughly 94%, belong to a single connected component, the giant network that knits twenty years of municipal politics into one piece of structure. The remaining 6% are not absent from politics; they sit at the periphery of the graph, mostly as one-off council candidacies in small parties whose local slate had no partymate in the same municipality and no mayoral bridge to the rest of the state. The invisible architecture, in other words, has a thick modular core, a sparse periphery, and a clear boundary between the two.
The data: twenty years of candidacies, six cycles, one state
The base of the study is public data from the Tribunal Superior Eleitoral (TSE), the Brazilian Electoral Court. Two tables are merged with care: candidate registrations and per-candidate results. The cut is precise.
- State: Ceará (CE).
- Type of election: municipal.
- Cycles: 2004, 2008, 2012, 2016, 2020, 2024 — six cycles, the entire period in which Ceará’s municipal elections have been conducted with full electronic voting.
- Offices: prefeito (mayor) and vereador (councilor).
- Filter: registrations with
situação = deferidoand present in both tables after the merge (_merge == "both").
Applied to the raw TSE bases, this filter yields a clean and reproducible set of numbers. They are recorded in the pipeline’s audit file and can be reconciled directly with the CSVs the scripts produce.
- 71,977 candidacies observed over the period.
- 46,258 unique individuals, identified by
título eleitoral. - 184 municipalities — every municipality in Ceará.
- Six cycles, two offices, one state.
- 495,393 edges in the aggregate graph, 43,551 nodes and 492,973 edges in its largest connected component.
That gap between 71,977 candidacies and 46,258 people is the first quiet piece of evidence the data offers: many of the same people run, again and again. The political life of Ceará between 2004 and 2024 is, to a meaningful extent, a recurrent population. That is a fact, not yet an interpretation. The study tries to make sense of it.
The political backdrop: three eras in twenty years
For readers outside Ceará, a brief political backdrop helps to understand what the network is actually mapping. The twenty years covered by the study span three distinct phases of state politics.
The first, 2003–2006, closes the long tucano cycle that had organized Ceará’s politics since the 1980s, ending with the governorship of Lúcio Alcântara (PSDB). The first municipal election in our window, 2004, still belongs to that era.
The second, 2007–2022, is the era of the PT–PDT–PSB alliance. It begins with Cid Gomes (PSB) winning the governorship in 2006 and serving two consecutive terms (2007–2014). It continues with Camilo Santana (PT), governor from 2015 until April 2022, when he left office to run for the Senate, opening the way for his vice-governor Izolda Cela to finish the term, the first woman to effectively occupy the governorship of Ceará. For sixteen years, this coalition organized state politics around shared candidacies, shared campaign infrastructure and stable partisan blocks across the state. Fortaleza, in the same period, was governed by Luizianne Lins (PT, 2005–2012), then by Roberto Cláudio (PSB and later PDT, 2013–2020), and then by José Sarto (PDT, 2021–2024). Most of the dense partisan-municipal cliques that the network detects were forged during this period.
The third phase, 2022–present, begins with the rupture of that alliance. When the PDT chose to launch Roberto Cláudio for governor in 2022, instead of supporting governor Izolda Cela, who was backed by the PT, the sixteen-year coalition broke. The PT launched Elmano de Freitas, who won in the first round with 54.02% of the vote, against Capitão Wagner (União Brasil, 31.72%) and Roberto Cláudio (PDT, 14.14%). In February 2024, Cid Gomes left the PDT and joined the PSB, restoring his alliance with Camilo and Elmano, and sealing the public split with his brother Ciro Gomes, who moved to the PSDB. The last municipal election in our window, 2024, closed the period with the PT returning to Fortaleza’s mayorship after twelve years: Evandro Leitão (PT) defeated André Fernandes (PL) in the second round, 50.38% to 49.62%, with the national Lula–Bolsonaro polarization projecting itself onto the local dispute.
These three phases are not just historical backdrop. They leave structural signatures in the network, which the next sections begin to read.
How the network was built
For the network to be useful, the rules by which two candidates are connected must be explicit and defensible. I use two rules, both applied within each electoral cycle.
Rule 1 — same party, same municipality, same election. Every candidate of a given party in a given municipality in a given election is linked to every other candidate of the same party in that same municipality and election. Operationally, this rule groups all candidacies by the triple
(year, municipality, party)and connects everyone within the group. It generates roughly 87.5% of the edges in the aggregate graph.Rule 2 — same party, same election, mayoral candidates across different municipalities. Mayoral candidates (prefeitos) of the same party are linked to one another across different municipalities of the state in the same election. Operationally, this rule filters the data to keep only mayoral candidacies, groups them by
(year, party), and connects everyone within each group. It generates the remaining 12.5% of the edges and provides the long inter-municipal bridges of the graph.
One detail of Rule 1 is worth a short pause, because it can look surprising at first sight. Rule 1 does not filter by elective position. It links a party’s mayoral candidate to all of that same party’s council candidates in the same municipality and the same election. That choice is deliberate, and it is grounded in how Brazilian municipal campaigns actually work on the ground.
In Brazil’s institutional design, the prefeito sits in the municipal executive (the Prefeitura), and vereadores sit in the municipal legislative body (the Câmara Municipal). They are not part of the same branch of government, and that constitutional distinction matters for any analysis of governance, accountability or policy. But the edge rule is not describing institutional separation; it is capturing the local partisan campaign, which I have seen up close in more than one cycle. In every Brazilian municipal election, a party’s mayoral candidate and its council candidates in the same municipality run together as a single local slate: same platform, same territorial divisions, same operational unit on the streets. They dispute seats in different branches, but they wage the campaign as one. Filtering by office inside Rule 1 would mechanically disconnect a mayoral candidate from his or her own party’s councilors in the same city and the same year, and would erase precisely the partisan-municipal fabric this study is trying to map. The elective position is preserved as a node attribute and can be used in any downstream analysis; it is, in fact, the very attribute that defines Rule 2 (which restricts itself to mayors). It simply does not enter the grouping criterion of Rule 1.
The combination of the two rules has a subtle but powerful consequence. Two council candidates of the same party in different municipalities are not directly linked by any edge: Rule 1 connects only candidates in the same municipality, and Rule 2 connects only mayoral candidates. And yet, they end up in the same connected component whenever both municipalities also fielded mayoral candidates of that party. The path goes: councilor X — mayor of B — mayor of C — councilor Y, four nodes and three edges, with the two mayors acting as the structural pivots. The mayoral bridges of Rule 2 sew together the partisan-municipal cliques of Rule 1. This is precisely how a graph built from purely local cliques ends up with 94% of its nodes in a single giant component — and it is why the 881 isolated nodes I describe later are, almost without exception, council candidates from parties that did not field a mayoral candidate in their municipality (no Rule 1 partner) and either had no mayor anywhere else in the state, or were not themselves mayors to begin with (no Rule 2 bridge). The structure of the network is, in this very precise sense, carried by the mayoral races.
To prevent the size of local groups from mechanically dominating everything (a capital city has many more candidates per party than a small interior municipality), each edge inside a group receives a normalized weight. The total “force” of any candidate, contributed by a single group, is therefore constant. It is a way of decoupling topological support (who is connected to whom) from intensity (how strong the connection is).
The same logic is then carried into the time dimension. The pipeline builds six annual snapshots, one for each cycle, and a single aggregate graph that consolidates them. On the aggregate, three weighting scenarios coexist: a direct sum (weight_sum), a temporal-persistence rescaling (weight_final_global, which is the official scenario of the study), and a co-appearance variant (weight_final_coappear). The official scenario penalizes one-off connections and rewards links that come back, cycle after cycle. Persistence becomes weight.
What network science measures
On a graph this size, classical complex-network metrics start to do their job. I use the standard toolkit, without inventing exotic measures.
- Degree counts a node’s direct connections.
- Strength sums the weights of those connections.
- PageRank — yes, the same algorithm Google used to rank the web — estimates how much “structural attention” a node receives, weighted by the attention received by its neighbors.
- Eigenvector centrality rewards nodes whose neighbors are themselves well-connected.
- Betweenness measures the extent to which a node sits on the shortest paths between others — in plain words, how much it acts as a bridge.
- k-core finds dense cores: the k-core is the subgraph in which every node has at least k internal links.
- Modularity and communities (Louvain) partition the network into densely connected clusters.
A caveat I will repeat as often as needed: these metrics report structural positions in the model, not “political power” in the broad sense. A high-degree candidate is not the same thing as a powerful politician. The first is a fact about the graph; the second is a judgment about the world. The two are sometimes related and sometimes not, and the distinction is fundamental.
The architecture revealed
Here is what the numbers look like once the pipeline runs.
The aggregate is one big modular thing, with a thin periphery. The graph that consolidates all six cycles has 46,258 nodes and 495,393 edges, distributed across 1,491 components. One of those components, the largest connected component, contains 43,551 nodes (94.1%) and 492,973 edges (99.5%). The other 1,490 components are small: 881 are single isolated nodes, with no links at all, and the rest are tiny clusters of 2 to 16 individuals each. Those isolated nodes have a very specific signature when I cross them back with the candidate file: 879 of the 881 are vereador candidacies, and 824 appear in only one cycle, mostly in the years up to 2016, in small parties (PC do B, PV, PMDB, PSC, PSL, PHS and similar) whose local slate that year had no other partymate in the same municipality and no mayoral candidate of the same party in any other Ceará municipality to bridge them into the rest of the state. The construction rule of the network is sharp on this point: a candidate needs at least one partymate-municipality-year companion (or, if they are a mayor, at least one fellow mayor of the same party elsewhere in the state) to enter the graph at all. The 881 isolated nodes are precisely those who satisfied neither condition. In other words, stacking twenty years of municipal candidacies on top of each other does not produce a constellation of small galaxies. It produces one very large modular galaxy plus a thin, recognizable periphery of one-time, lone candidacies that never linked into the main fabric.
That structure is extremely modular. Louvain detects 159 communities, with a modularity Q ≈ 0.94 — a value that, in network science, signals a clearly partitioned graph. The median community has 202 nodes; the largest has 4,057. The mechanism that generated the graph (party–municipality cliques) does most of the work to explain why modularity is this high. What is informative is the shape of the communities and the bridges between them.
The annual snapshots are fragmented. Each year-by-year network is a different story. In 2020, the peak year of the period, the snapshot has 14,386 nodes and 140,164 edges, but 634 components, and the largest connected component contains only 1,517 of those 14,386 nodes. In 2024, the same pattern: 11,953 nodes, 730 components, and an LCC of 987 nodes. Local clustering inside each year is very high (around 0.87–0.98), but global connectivity in a single cycle is the exception, not the rule. Twenty years of cycles, on the other hand, weave nearly every individual into the same fabric.
This contrast is one of the study’s central findings. Ceará’s municipal politics is not a sequence of independent elections. It is a cumulative system. The connectivity you see is not built in any one year; it is built across years.
Different metrics tell different stories. The Top-10 changes as I change the lens.
- The Top-10 by degree and strength is dominated by prefeitos of small and medium-sized interior municipalities who reappear, cycle after cycle, in the same party. The highest-degree node in the entire aggregate is Dr Vilmar (PSB, Acopiara), who appears in all six cycles between 2004 and 2024 with 383 direct connections in the graph. Several others in the Top-10 — Dr Nilson Diniz (Cedro), Edinho Nobre (Banabuiú), Maninho Palhano (Fortaleza), Marcondes Ferraz (Saboeiro) — share the same profile: prolonged territorial presence within the same party in the same municipality.
- The Top-10 by PageRank repeats much of this list, with Dr Vilmar at the top once again and a few new names entering through dense local neighborhoods.
- The Top-10 by eigenvector is more concentrated still. It points to a small number of municipalities, notably Brejo Santo and Milagres, both in the Cariri region, where entire local partisan slates form extremely dense, eigenvector-saturated clusters.
- The Top-10 by betweenness, the metric of structural bridges, reads almost like a who’s who of Fortaleza mayoral races, with a handful of metropolitan and interior mayors completing the list. The top values, in order, belong to candidates well known to anyone who has followed Ceará’s politics: José Sarto (Fortaleza), Roberto Cláudio (Fortaleza), Capitão Wagner (Fortaleza), Atila Camara (Maranguape), Luizianne Lins (Fortaleza), Naumi Amorim (Caucaia), Wembley “Beim” Costa (Paracuru), and again Dr Vilmar (Acopiara), this time as a small-town bridge across cycles, followed by Guilherme Saraiva (Barbalha). Mayoral campaigns in the capital and in major metropolitan and regional municipalities act as the structural connectors of the state’s political graph, precisely because they aggregate partisan slates across cycles in cities large enough to host competitive disputes.
- The k-core of the aggregate reaches 131: there is a subgraph in which every member has at least 131 internal connections. That is a very deep core.
Recurrence carries the structure. When I cross the rankings with the enriched node files, a pattern becomes hard to miss: the top centralities are sustained, in most cases, by four to six cycles of consecutive presence, almost always in the same party and the same municipality. The architecture of the vote is not built in any single election. It is built by people who keep coming back.
A small biographical note that the data made unavoidable
One of the names that the betweenness ranking returned is Roberto Cláudio (PDT, Fortaleza). I cannot pretend the coincidence is invisible to me: between 2015 and 2020, I worked as a technical advisor at the Mayor’s Office of Fortaleza during his administration. The graph does not know that. The graph only sees that, across the cycles in which he appeared as a candidate, he sat on a particularly large number of shortest paths between modules of the network. It is a structural reading, derived from public TSE data, not a personal endorsement nor a political assessment.
The detail matters because it illustrates, with my own life, the basic methodological discipline of the study. A candidate’s centrality is not a measure of their power; it is a measure of where they sit in a model. I happen to know the political flesh behind some of these names. The metric does not. And it is precisely by keeping the metric agnostic that we can use it to reveal patterns we did not put there by hand.
The graphs return: an intellectual continuity
There is one more thing I want to register, and it is more personal than methodological. My master’s dissertation was titled Efeito de Enquadramento no Modelo de Grafos para Resolução de Conflitos, an application of the Graph Model for Conflict Resolution (GMCR) to the disputes around the Cocó viaducts in Fortaleza. My current doctoral track at the University of Porto continues that line: behavioral biases, framing effects, and uncertainty in graph-based conflict modeling, presented at EURO 2024 in Copenhagen and at the Global Decision and Negotiation Conference 2024 in Portugal. (I keep a chronological bibliographic history of GMCR on this blog for anyone interested.)
In other words: I have been thinking about politics through graphs for some time, but in a different register. GMCR was a tool to model bilateral or multilateral strategic conflicts: a few actors, a few options, a few preferences, a defined dispute. The Ceará electoral study is, in a sense, that same intellectual habit applied to a radically different scale: 46,258 actors, 184 territories, six cycles, half a million links, with no defined dispute at all. The same word, graph, covers both, but the object is no longer a conflict; it is a structure.
I find that continuity worth saying out loud. The graphs come back, in another scale and with another ambition. The architecture they help reveal is not built to be resolved. It is built to be understood.
What this lens shows about local politics
Putting all of this together, a careful and prudent interpretation looks like this.
Ceará’s municipal politics, observed through this network, is a persistent relational system, organized along three lines.
The first is strong modularity. The graph is unambiguously partitioned into communities that correspond, in most cases, to party–municipality blocks, with a smaller number of bridges, overwhelmingly mayoral races in larger cities, that knit the blocks together.
The second is cumulative connectivity. Each cycle, on its own, looks fragmented; many small components, a modest largest one. Twenty years of cycles, stacked, produce a single giant component containing more than 94% of all candidates who appeared in the period. The connectivity of state politics is a temporal product, not a snapshot.
The third is centrality anchored in continuity. The candidates the network places at the top of its centrality rankings are, in their overwhelming majority, people who appear in four, five, or all six cycles, in the same party and the same municipality. The network, in its official weighting scenario, rewards coming back. Episodic appearances do not generate central positions. Persistence does.
This is what I think the network is showing. It is a complementary lens to the more traditional reading of elections through votes and outcomes. It does not replace anything; it adds a dimension that, without this kind of tool, would stay where it usually stays — invisible.
A note on the coincidence between the network and the political history of the state. The strong modularity that the network displays is not just a mathematical curiosity; it is also coherent with what actually happened politically in the period. For sixteen years, from Cid Gomes’s first election as governor in 2006 to the rupture of 2022, Ceará’s state politics was organized around a stable PT–PDT–PSB coalition, with shared mayoral and council candidacies in many municipalities. That coalition produced precisely the kind of dense partisan-municipal blocks the network detects, and it explains why the modularity remains so high even when we collapse twenty years into a single aggregate graph. The 2022 break — the PDT launching Roberto Cláudio against the PT-supported governor Izolda Cela — and the subsequent migration of Cid Gomes from the PDT to the PSB in 2024, restoring his alliance with Camilo Santana and Elmano de Freitas, are structural events that will leave their signature on the next cycle of the study. The 2024 election alone, the last one in our window, already carries the first traces of the new configuration; a full reading of the new equilibrium will only be possible when 2028 enters the dataset.
Limitations
A study like this rests on methodological choices, and those choices have consequences.
The first is that the network depends on the rule by which candidates are connected. Choosing (year, municipality, party) plus an inter-municipal mayoral rule was a defensible choice, but other choices — including office in the grouping, using coligações instead of parties, aggregating by micro-region — would produce different graphs and, possibly, different patterns. The study argues for its rule; it does not pretend that no other rule exists.
The second is conceptual. Edges in this graph represent electoral co-affiliation, not directly observed personal relations. Two candidates linked in the network shared a partisan-municipal context in a given cycle; whether they knew each other, allied formally, or had any personal interaction at all is something the model cannot say. The model is, deliberately, agnostic about that.
The third is that TSE data, while public and detailed, are not perfect. Registry inconsistencies, identification changes across years, and residual duplicates exist. The pipeline applies filters (_merge == "both", situação = deferido, identification by título eleitoral), but a small fraction of noise almost certainly survives.
The fourth I have already said and will say again: structural centrality is not a measure of political power. It is a measure of position within the modeled graph. Reading it as the former is a category mistake.
The fifth: the aggregate graph collapses time. It is excellent for revealing trajectories and persistence, but it loses the calendar. That is why the study works with snapshots and aggregate in parallel — different representations answer different questions.
Finally…
The last cycle in the dataset, 2024, is also the one that suggests the next chapter of this story. The arrival of the PL in the Fortaleza second round with André Fernandes, the open projection of the national Lula–Bolsonaro polarization onto the local dispute, and the tight victory of Evandro Leitão (PT, 50.38%) that returned the party to the Fortaleza mayor’s office after twelve years, all point to a reconfiguration of the partisan-municipal cliques the network has been measuring. The architecture has begun to shift. The 2028 election, when it enters the dataset, will be the place to read how deep that shift goes, whether the new alignments produce new modules, whether the old bridges hold, and whether the recurrent population of Ceará’s politics rearranges itself around different party–municipality pairs.
There is something deeply Cearense about discovering, in the dry mathematics of a graph, what the state’s political memory already knew. The continuities. The lineages. The party–territory pairs that survive any single election. The persistent presence of certain mayors of small towns whose names rarely make state-wide news but who keep an entire local network stitched together cycle after cycle. The structural role of the capital’s mayoral races as the bridges that connect modules across the whole state. The architecture is not what we hear about. It is what holds up what we hear about.
I spent a decade inside that architecture, without seeing it from above. I am spending another decade trying to see it from above, without forgetting that it is the same thing. There is no contradiction between the operator and the researcher, only different scales of attention.
What network science offers, in studies like this one, is a discipline of attention. It forces us to make our rules explicit, to measure what we claim to see, and to admit what we cannot say. It does not replace the political reading of elections; it reorganizes the desk on which that reading happens. And, every once in a while, it lets us see the invisible architecture of the vote, not as metaphor, but as a real, measurable, modular, persistent thing.
That, I think, is worth doing. For the next cycle, and for the cycles after that.
Deoclécio Paiva de Castro
Ph.D. Candidate in Economics, Faculty of Economics, University of Porto
M.Sc. in Mathematical Modeling and Quantitative Methods, UFC
B.Sc. in Industrial / Production Engineering
Tags: complex networks; municipal elections; Ceará; network science; political analysis; data

