When designing a dungeon map, you should first start with a flowchart. Draw each room as a small circle or little box, and then draw all the connections to each other room. Make this a solid line if it's an easy passage, or a dotted line if there's something tricky about that passage (such as it's behind a secret door, or needs to be cleared of rubble, or must be opened with a special key). You'll end up with more lines than circles or boxes, and that's just fine; this initial exercise is to focus on the map's utility in play. Now, ask yourself a few things:

Do I have enough encounter spaces? Do you have enough separate rooms for all the encounters you want to build in the dungeon? If not, add more!

Do I have enough non-encounter spaces? A good dungeon has some "downtime" rooms where the heroes might simply get some clues, set up a trap, or rest. Most dungeons shouldn't have an encounter jammed in every room.

How do your toughest fights connect? Note which of your rooms have the hardest fights in the dungeon. If any of these are connected to another by a single, solid line, you're setting your heroes up for trouble: they can stumble into a lethal fight, then stumble into an equally lethal fight immediately thereafter. Worse, if your dungeon denizens come to each other's aid, you could be doubling up on the danger. Either put another room in between, or make the solid line a dotted line (putting it behind some sort of barrier that must be navigated), or both.

Avoid railroad tracks. If your flowchart has a lot of line-box-line-box-line-box with no branching paths, it's probably pretty dull; you've designed a railroad, not a dungeon, and you've taken away a lot of player choice. Try drawing a few other connections to these rooms to make them approachable from more directions.

Lines can cross. Don't worry if your lines cross; your passages might be an intersection, or one might go over the other. In an overtly magical dungeon, one might phase through or teleport across the other so they don't actually intersect. All these are fine; just think how you'll address this in your final map.

What's hidden by dotted lines?
If you have rooms whose only connections are dotted lines, think about what happens if the heroes never get into that room. Maybe they just don't find the secret door, or can't move the cave-in, or kill the helpful NPC that would show them the way. If your rooms hidden by dotted lines are just side encounters or treasure vaults, that's just fine; not every single dungeon needs to be wholly scoured. But if you've got a main villain there, you need to think carefully about how the heroes will get in. As with any key plot obstacle, you should have at least 3 ways for the heroes to progress forward; at this stage, that often means such rooms should have 3 dotted lines to them if they don't have any solid lines to them.

What do you do when you have a flowchart you like? You probably draw it again, so you can get another look at it with the changes you've made above. I like to flip the map upside down and redraw it, as that emphasizes the connections without the baggage of "heroes start here, go here, go here" that fills the narrative in my mind.

Then, redraw the map with the rooms the rough size you're going to make them in the final map. This isn't your final map, so you can be messy with this step. You just want to get a sense of space of the rooms and ensure you'll have the physical space to include the passages you want. Remember that a line you drew might be a winding hallway a hundred feet long, or could be a short corridor only 10 feet long with a simple door in the middle. Keep in mind that some of your boxes or circles might also be physical halls, like a trapped portcullis--that's its own encounter, so it was a box on your flowchart but a hallway on your rough map.

A final note: if you're writing something with multiple dungeons in it (like a long adventure), compare your flowcharts to each other. They should look different, as that will give variety in play. One might have lots of connections in a ring shape (or even several overlapping rings) while another looks like a tree, with a lot of dead ends. Both are fine. Having both together in one adventure keeps your dungeons unpredictable and therefore interesting.

I've got a few more map thoughts about where to go from here, which I'll discuss next time!