Discrete Math for Data Science

DSCI 220, 2025 W1

December 3, 2025

Announcements

Graphs

Today

  • Mixer
  • graph invariants
  • “twin” graph puzzles
    • they share many invariants, but
    • are they isomorphic?
  • Big takeaway:
    • Easy invariants help sometimes
    • But there is no known “magic test” for graph isomorphism

Mixer

How are the numbers on your cards related to one another? The same rule will apply to the numbers on all of your cards.

Euler’s Formula

Observe:

  • This is true for every connected planar graph

Proof of Euler’s Formula

Claim: For any connected planar graph, \(G=(V,E,F)\), __________

Proof:

Observation 1

Start with a connected planar graph \(G = (V, E, F)\).

Remove a non-bridge edge \(e\) to form \(G' = G - e = (V', E', F')\).

  • Edge \(e\) lies on a cycle.
  • It borders two distinct faces.
  • Deleting \(e\) merges those two faces into one.

\[ V' = V,\quad E' = E - 1,\quad F' = F - 1 \]

Observation 2

Start with a connected planar graph \(G = (V, E, F)\).

Remove a bridge edge \(e\) to form \(G' = G - e = (V', E', F')\).

  • Edge \(e\) is not on any cycle.
  • Both “sides” of \(e\) touch the same face.
  • Deleting \(e\) does not change the number of faces.

\[ V' = V,\quad E' = E - 1,\quad F' = F \]

Observation 3

After removing a bridge \(e\) from \(G = (V, E, F)\), we get a graph \(G' = G - e = (V', E', F')\) with two connected components: \[ G_1 = (V_1, E_1, F_1),\quad G_2 = (V_2, E_2, F_2). \]

When drawn separately, each \(G_i\) has its own outer face.

When drawn together in one plane as \(G'\):

  • The two outer faces become one shared outside face.
  • The total number of faces of \(G'\) is \[ F' = F_1 + F_2 - 1. \]

Graph isomorphism

Two graphs \(G\) and \(H\) are isomorphic if:

  • You can rename the vertices of \(G\)
  • So that the edge pattern becomes exactly the edge pattern of \(H\)

Equivalently:

If you erase vertex labels and just look at the shape,
the two graphs look the same.

We’ll play a game:

  • I show you two graphs, \(G_1\) and \(G_2\)
  • You say: “Same or different?”
  • Then we look for simple invariants to justify your answer:
    • “They can’t be the same, because…”

What’s a graph invariant?

A graph invariant is: Any property that is the same for all isomorphic copies of a graph.

Examples:

  • Number of vertices \(V\) or edges \(E\)
  • Degree sequence
  • Number of triangles
  • Whether a graph has an odd cycle
  • …and many more

If two graphs are isomorphic, all invariants must match.

But the reverse is not obviously true:

  • Sharing a bunch of invariants does not guarantee isomorphism.

Pair 1: same V and E… are they the same?

Graph A

Path on 4 vertices (\(P_4\))

Graph B

Star on 4 vertices (\(K_{1,3}\))

Think with a neighbor:

  • Both have \(V = 4\) and \(E = 3\)
  • Are they isomorphic? Why or why not?

Invariant: degree sequence

Compute the degree sequence (sorted list of vertex degrees).

  • Graph A (path \(P_4\)): degrees are \([1,2,2,1]\)
  • Graph B (star \(K_{1,3}\)): degrees are \([3,1,1,1]\)

These disagree, so the graphs cannot be isomorphic.

New invariant:

Degree sequence is preserved by isomorphism.
If degree sequences differ, the graphs are definitely different.

But degree sequence is still not the whole story…

Pair 2: same V, E, and degrees

Graph C: Triangular prism

Triangular prism graph

Graph D: \(K_{3,3}\)

Complete bipartite graph (K_{3,3})

  • Same \(V\), same \(E\), same degree sequence \([3,3,3,3,3,3]\).
  • Are they isomorphic?

Invariant: triangles

Look for triangles (3-cycles).

  • Graph C (triangular prism):
    • Has obvious triangles.
  • Graph D (\(K_{3,3}\)):
    • Is bipartite,
    • Any cycle must alternate sides, so it has no odd cycles,
    • In particular, it has no triangles.

So:

  • number of triangles is a graph invariant.
  • It distinguishes C and D, even when \(V,E,\) and degree sequence match.

Pair 3: cube vs Möbius ladder

Graph E: Cube graph \(Q_3\)

Cube graph \(Q_3\)

Graph F: Möbius ladder

Möbius ladder \(M_8\)

  • Same \(V\), same \(E\), same degree sequence.
  • Both have no triangles.
  • Are they isomorphic? Can you see a structural difference?

Invariant: odd cycles / bipartiteness

Look for odd cycles:

  • The cube graph \(Q_3\) is bipartite:
    • You can color vertices red/blue so every edge joins red–blue.
    • Therefore it has no odd cycles.
  • The Möbius ladder has a 5-cycle:
    • e.g., follow around including one “twisted” chord
    • So it has an odd cycle, therefore it is not bipartite.

New invariant:

“Has an odd cycle?” / “Is bipartite?”
If one graph is bipartite and the other isn’t, they cannot be isomorphic.

Pair 4: two trees, same degrees, no cycles

Graph G

Graph H

Where we are

We’ve seen a chain of increasingly strong invariants:

  1. \(V,E,F\)
  2. Degree sequence
  3. Number of triangles
  4. Presence of any odd cycle
  5. More subtle structure

At each step:

  • We found pairs of graphs that matched all earlier invariants
  • But were still not isomorphic, distinguished by a new invariant

Takeaway

  • If two graphs are isomorphic, they must agree on every invariant.
  • When we find a violated invariant, we can confidently say: > “No, these graphs are different — here’s the evidence.”

But:

  • There’s no single, simple invariant that always settles the question.
  • In the worst case, finding a certificate of “different” can be very non-obvious.
  • Designing a fast general algorithm for graph isomorphism is a deep theoretical problem.

For today:

We’ve seen how counting and simple structural ideas
(degrees, cycles, distances) can be powerful tools
for understanding when two graphs “must” be different.