The Art of Connecting the Dots with the Wolfram Language

This post written by Tim Shedelbower was originally published on the Wolfram Blog. The full post can be viewed here.

White dots on a black background
Photo by Scott Webb on Unsplash

Connect the dots. It was exciting to draw from number to number until the sudden discovery of a hidden cartoon. That was my inadvertent introduction to graph theory very early in school. Little did I know adults used the same concept to discover hidden patterns to solve problems, such as proving that a single crossing of seven Königsberg bridges to four land masses is not possible, but coloring a map distinctly with four colors is. These problems inspired the methods we know today as graph theory. And in honor of the work of late mathematician and connect-the-dot author Elwyn Berlekamp, we see how sophisticated this “child’s play” can be by examining the different styles and themes we can apply to graphs.

Dots and lines connecting and forming geometric shapes

Graph theory has a history dating back to 1735, when the Königsberg bridge problem was proved to be not possible by Swiss mathematician Leonhard Euler. Today it touches us in many ways, from discovering the shortest route while on vacation to returning relevant links with a web search. Smooth traffic flow, efficient package delivery and reliable power grids utilize graph theory and affect our daily lives.

The Wolfram Language provides an extensive set of tools to reveal the underlying structures of a particular graph. Styling plays a significant role in the ability to analyze these graph structures easily. The PlotTheme family of themes, already used by the Wolfram Language’s visualizations and gauges, has found its way to the graph functions and provides a simple way to apply various styles.

As with any family, each member has its own unique personality. The personality of each theme was designed to help with the visual challenges that surface during graph analysis. Some themes work well locating paths in a complex graph, while others add visual excitement to an otherwise mundane graph.

How Does PlotTheme Work?

PlotTheme sets a theme for Wolfram Language visualizations. A theme is a list of option values called by a single string name.

CompleteGraph function
Points forming a star surrounded by a pentagon

Included are the eight original base themes plus three feature themes found only in Graph: “LargeGraph”, “ClassicLabeled” and “IndexLabeled”.

Graph themes, from Monochrome to Scientific

Each theme automatically handles its own highlighting style.

Graph themes with various ways of highlighting points

Which PlotTheme Should I Use?

PlotTheme does not overwhelm with an unlimited number of themes. Instead, each theme includes specific useful features.

For example, these features can help locate a path in a complex network:

Complex networks of Minimal and LargeGraph

Spice up a graph with different colors and shapes.

Web, Business, and Marketing highlighted themes

Locate a specific vertex with labels.

Locating vertices with different themes

Produce artwork suitable for one-color printing.

Monochrome theme

Gratify an artistic side with color variety.

Miminalist collections of lines displayed in various colors, from bold to pastel

And of course, for the sentimental, the original styles remain available.

Original styles of Classic and ClassicLabeled

A PlotTheme combined with GraphHighlightStyle eases the task of finding that perfect style. As illustrated here, it helps the “LargeGraph” theme reveal a path in a complex graph:

GraphHighlightStyle helping to showcase two complex graphs, showing fade and DehighlightGray

Literally Connect the Dots with Graph and PlotTheme

This section is for those who came to this blog expecting a function to connect the dots. The function utilizes Graph and PlotTheme and is included with the downloadable notebook of this blog.

Minimalist collection of numbered dots showing a panda shape

Set the “ShowSolution” option to True to see the result.

Dots removed to show lines that trace the shape of a minimalist panda

Other themes provide unique styling.

Dots styled to form the border shape of a panda

Visually simplifying a problem with graph theory is a necessity in our world of growing complexity. Explore examples in the Wolfram Demonstrations Project to see what others have discovered. Visit the Graph Visualization and PlotTheme documentation pages to learn more.

--

--

Tech-Based Teaching Editor
Tech-Based Teaching: Computational Thinking in the Classroom

Tech-Based Teaching is all about computational thinking, edtech, and the ways that tech enriches learning. Want to contribute? Reach out to edutech@wolfram.com.