Connected Components #

Occasionally someone will ask me how to implement Connected Components, which is useful for several things, including

  • determining whether there's a path between two points; if there isn't, you can skip running pathfinding
  • finding the islands/continents on a procedurally generated map

It's actually a clever use of Breadth First Search. Every time the queue is empty, you find an unvisited node and put it into the queue, and then run the loop some more. When you have no more unvisited nodes, you're done.

Connected Components

Labels:

Little details #

Back in 2019 I started a page with a list of all the little things I do on my pages. One of the things I have a problem with is that I don't finish something, and then I don't share it, and then nobody benefits. I'm wanting to share more partial projects. So I shared that page, even though it wasn't finished.

Since then I've added sections about

  • coloring controls to match the diagrams
  • state machines
  • linkable sections
  • arrows in svg, canvas, and outside the container
  • two column layout
  • backwards compatibility
  • removing build steps
  • adding build steps
  • markup languages
  • topic-based vs time-based projects
  • pre-rendering
  • meta tags for social media
  • support for printing

https://www.redblobgames.com/making-of/little-things/

The page is uneven, with some sections being detailed and others being simple links to other pages I've written, but I am hoping it's useful for people writing explanations on the web. More importantly, I'm building it as a reference for myself. I'm adding code snippets there too, so that the next time I need a draggable svg, I can go to that page and grab the code, and also read about the gotchas that I might've forgotten to check.

Labels: