# Graph Theory (or, alternate ways to rank the Big Ten this year)

Submitted by Swayze Howell Sheen on December 1st, 2010 at 11:08 AM

Football is not transitive. What do I mean? Simple. If Team A beats Team B, and then Team B beats Team C, it does not mean that Team A will beat Team C. We all know this.

Proof of non-transitivity this year comes in the Big Ten. Let's look at the Big Ten Graph. The graph is simple to understand: each team is a node (circle), and there is an line connecting each team that played another team. The line is actually an arrow, making this a directed graph, in the obvious form: if there is an arrow from Team A's node to Team B's node, it means Team A beat Team B. Here is the graph:

The Victory Graph (Click on it for full size)

There are lots of fun cycles to find in the graph. For example, Minnesota beat Iowa, who beat Michigan State, who beat Minnesota. See how many of these three-node cycles you can find (there are plenty). Or not, depends how bored you are at work. There are bigger ones too: for example, Michigan beat Indiana who beat Purdue who beat Minnesota who beat Iowa who beat Michigan State who beat Wisconsin who beat Michigan. And it goes on.

The most amazing fact from the graph, thanks to Indiana finally getting a win, is that the graph is strongly connected. In graph terminology, this means you can get from any node in the graph to any other node, simply by following arrows, for all pairs of nodes. This really shows how non-transitive football is: you can use this graph to say any team "transitively beat" any other team, at least in the Big Ten this past year. For example, Indiana beat Purdue, who beat Minnesota, who beat Iowa, who beat Michigan State, who beat Wisconsin, who beat OSU. If football were transitive, Indiana "beat" OSU! Except when they played, of course.

One interesting metric for each pair of teams (A, B) is the shortest path to victory for A over B. Some of these "shortest paths to victory" are easy to find: for example, it is unfortunately the case that there is a short and quite direct path from OSU (at the top) to Michigan. Some are harder to see: for example, see if you can find the path where Michigan "transitively" beats OSU. This "shortest path" is actually long: 6 steps (the answer is at bottom).

We can then use this graph to order the teams a different way: what is the shortest path between a team and every other team in the Big Ten? Lower is better here: a path of length 1 means Team A directly beat Team B, whereas a path of length 2 between Team A and Team B means that Team A beat Team C who in turn beat Team B. Here is the full summary of the shortest paths between all pairs of Big Ten teams:

 OSU Illinois Ind Wisc Purdue Minn PennSt Iowa Mich MichSt NorthWest AVERAGE OSU 0 1 1 3 1 1 1 1 1 2 2 1.4 Illinois 5 0 1 4 1 2 1 2 2 3 1 2.2 Indiana 6 3 0 5 1 2 4 3 4 4 2 3.4 Wisconsin 1 2 1 0 1 1 2 1 1 2 1 1.3 Purdue 5 2 2 4 0 1 3 2 3 3 1 2.6 Minnesota 4 1 2 3 2 0 2 1 2 2 2 2.1 PennState 5 2 1 4 2 1 0 2 1 3 1 2.2 Iowa 3 2 1 2 2 2 1 0 1 1 2 1.7 Michigan 6 1 1 5 1 2 2 3 0 4 2 2.7 MichState 2 1 2 1 1 1 1 2 1 0 1 1.3 Northwestern 4 2 1 3 2 1 2 1 2 2 0 2.0

You can then use these to create a new ranking among teams, based on their average shortest path to victory:

 1 Wisconsin 1.3 1 MichState 1.3 3 OSU 1.4 4 Iowa 1.7 5 Northwestern 2 6 Minnesota 2.1 7 PennState 2.2 7 Illinois 2.2 9 Purdue 2.6 10 Michigan 2.7 11 Indiana 3.4

This ranking kind of makes sense, too. If you beat a lot of teams directly, then you will have an average near 1 (note that even undefeated teams will average higher than 1, because teams don't all play each other). If you only beat bad teams, who in turn only beat other bad teams, your average will be higher. Thus, Michigan does poorly in this comparison; Minnesota does better because they beat Iowa, who actually beat some good teams (like MSU). Only Indiana fares worse than our boys in Blue.

You can also prune the graph to arrive at some interesting findings. For example, let's say we remove all edges where one team didn't resoundingly beat the other team. I will arbitrarily deem a win as a "strong" win when one team beats the other by more than 10 points. The graph now looks like this:

The Strong Victory Graph (Click on it for full size)

Wow, that is a much different graph! The first thing that stands out: there are no cycles in this graph. That means that if Team A "strongly beat" Team B, and Team B "strongly beat" Team C, that Team C didn't "strongly beat" Team A. There are no cycles here my friends.

We can also then use the "Strong Win" Graph to compute a new ranking. For each strong win, you get a +1, and for each strong loss, you get -1. Here are the teams, ranked by this new "Strong Win" scoring system:

 Rank Team StrongWins StrongLosses Score 1. Wisconsin 6 0 6 2. OhioState 6 1 5 3. MichState 3 1 2 3. Iowa 2 0 2 3. Illinois 4 2 2 6. PennState 3 3 0 7. Michigan 1 3 -2 8. Purdue 1 4 -3 8. Northwestern 0 3 -3 10. Indiana 0 4 -4 11. Minnesota 0 5 -5

This is actually a pretty reasonable ranking I think. Wisconsin is on top, because they beat the tar out of everyone (almost). Michigan State doesn't fare nearly as well as Wisconsin and OSU, because they had many close wins and one game where they were trounced (Iowa). Michigan ends up behind Illinois and Penn State in this ranking, because those two teams had a number of big wins, where Michigan only had one (Purdue, and barely "strong" at that).

Anyhow, that's a short look at how graphs can help us rank teams in different ways. And if you didn't like it, well, remember that I Hate Everything too.

[EDIT: Some people asked how I generated the graphs. All automated, given an input of games and scores. Some python code to compute shortest paths between nodes (there are some fairly standard algorithms for doing this) and then Graphviz to layout the graphs automatically. It would be easy to do this for any set of games.

One other note: the real point of the "Strong Win" graph is how silly it is that score differential is ignored in current computer rankings. A big score difference is a useful metric, and one that I think is better than many other simple ways of comparing teams. One could likely come up with a slightly more nuanced "Strong Win" definition (say, win by 10 and outgain the other team by some threshold number of yards); this was just a simple and easy way to start.]

Appendix:

The path for "transitive victory" of Michigan over OSU: Michigan beat Illinois who beat Northwestern who beat Iowa who beat Michigan State who beat Wisconsin who beat OSU. Ugh, it is really hard for us to beat OSU, apparently.

The strong victory graph provides a nice objective ranking and passes the eyeball test. The first graph appears to give too much credit for a big upset. Minnesota is obviously not that strong of a team.

Now THIS is interesting. I am curious how this would look for all FBS teams. I smell a future BlogPoll entry.

It is fascinating.  Now, did anyone in the Big Ten have a common opponent with Stan . . . (third rail) . . . oh, never mind.

I can't speak to where he learned it, but this is very similar to a common problem in computer science called the travelling salesman problem. You've probably seen it in MENSA or other puzzle books. You are given a graph with values on lines and you need to find the path that accumulates the least value to go from point A to point B. The algorithms to solve it have lots of applications in real life situations. The idea of averaging it would equate to finding the city on the map that the salesman would want to found his business in to ensure that we had the shortest possible travel time to other cities on the map.

Someone brought this up as a possbile poll for all of the NCAA. One problem that would arise is that teams with 0 wins in the group you are ranking would always have an infinite path to other teams. 3 teams with 1 win over each other would have an infinite path to teams outside of those 3. The same can be said of team trying to find a path over 12-0 or 11-1 teams (think about Big12 South 2008). I would say that if there is no path, you either can't count it or you have to weight it at 12 to account for this.

Rather than try to remove close games, I would say a weight given to a team for wins would be better. Something like 1 divided by the number of scores you won by adjusted for homefield advantage. So, winning by 27 at home (this would give you 24 on a neutral field) would give you a weight of .333. The path of MSU over Wisconsin would be 1. The path of Wisconsin over OSU would be .500. The path of OSU over Iowa would be 1. The path of Iowa over MSU would be .250. So, from this, you can see that the path of MSU over OSU would be 1.500, but the path of OSU over MSU would only be 1.250.

for the illumination.  I remember the travelling salesman problem but didn't put the two together.  I like your proposed application to deal with the eccentricities of the rankings.

The travelling salesman problem is a little bit different.  The goal there is to find the minimum-weight Hamiltonian cycle (passes through all vertices).  TSP is NP-complete, so it's difficult to solve it in any speed.

Here, we are looking for the minimum-weight path.  This can be solved in about V^3 steps (where V is the number of vertices=teams) using Floyd-Warshall (http://en.wikipedia.org/wiki/Floyd_Warshall).  As several people have already suggested, adjusting the weights for the strength of the win (i.e. mixing the two approaches) might be an improvement.  OT wins should be weighted less than everything else, though (winning by 8 in 4OT is not more dominant than a one touchdown win in regulation).

I think your issues are relevant.  I'd guess that most years, the graph even for the Big Ten is somewhere between strongly connected and acyclic.  Resolving these problems is probably the most important obstacle towards finding a consistently workable ranking.  The main goal is to reduce the graph somehow to a single directed path in the most representative way.  With that in mind, one idea is to keep deleting the edge with lowest weight until the graph is acyclic.  Then use either some adaptation of the "strong wins" ranking or (maybe better) an adaptation of topological sort.

Sadly, I don't know how to do any actual coding, so I can't implement any of these things myself.  I'd definitely like to see more things in this vein.

i really like the idea of searching for different ways to compare teams that leads to the best graph - i'll have to think about it, but definitely worth spending some time on...

as for your last comment, who in the world knows what Floyd-Warshall is but doesn't do any coding? Pure math guy?

it is kind of like an objective power ranking of the big ten. only downfall of it is if a crappy team somehow pulls one upset out over a dominant team, their shortest path average jumps to 2 (the minnesota effect). i dont know how to tease out those sort of details, but the 'strong victory' seems like a good start

For a simple measure, it produces a plausible ranking. A few years ago I went through and compared a bunch of "power" programs' historical records in close games (8 points or less) and blowouts (20 points or more) and found that with the exception of OSU they won barely 50% of the close games, but something like 90% of the blowouts. The cliche is that clutch performance separates good teams from bad teams, but the evidence suggests that the mark of a good team is the ability to take other teams to the woodshed.

Most interesting new diary I've read in quite a while.

I barely grasped the information contained in this diary which, in my world, means that it is extremely interesting and very informative.  Thank you for your hard work, Coach Schiano.

You're making it more complicated than it needs to be then.

All he did was place the 11 teams on the graph and draw arrows from the winner of a game to the loser of the game. Then he traced out the shortest path to get from one team to another. So, MSU beat Wisconsin, which gives them a path length of 1. MSU did not beat OSU so they have to go through Wisconsin to get to OSU, which gives them a path length of 2 (you travelled across two arrows). This is equivalent to saying "MSU beat Wisconsin, who beat OSU".

Doing this across all 10 teams and then averaging the results should give you a pretty good idea of how good a team is. If you win all of your games, your average will be 1.2 (1 pathway for the 8 teams you played and 2 pathways for the 2 teams you didn't play divided by 10 teams). The more teams you beat (and the better teams you beat), the better your score will be.

For example, Michigan needs to find a path to OSU. Well, we didn't beat them so we will have to go through a team that did beat OSU (Wisconsin). Well, we didn't beat Wisconsin so we will have to go through a team that did beat Wisconsin (MSU, then Iowa). Iowa lost 4 games, two to teams we've already covered and two to Northwestern and Minnesota, neither of which we played. But, we did beat Illinois who beat Nortwestern. So, our path to OSU becomes Illinois, Northwestern, Iowa, MSU, Wisconsin, OSU. That's a path of 6. You can see how beating OSU would have really helped us out. Not only would that 6 become a 1 (decreasing our average by .5), but our path to Iowa gets reduced from 3 to 2, because we can now say "we beat OSU, who beat Iowa" instead of saying "we beat Illinois, who beat Northwestern, who beat Iowa". That reduces our path to MSU and Wisconsin as well. So, now the score gets reduced by .8 in total.

The second part is aimed to reduce noise from upsets. Essentially, he's counting blowouts for and blowouts against. Wisconsin was blowing everyone out, so they have the highest score. He arbitrarily sets the limit for a blowout at more than 10 points, so that MSU's win over Wisconsin is forgotten (haha).

I thank you very much for this explanation.  It was very helpful and I genuinely appreciate it.

Was it a coincidence with shapes from Visio or did you use a mapping package?

I love to see the things I learned in my computer science and math classes applied to football. I think graph theory should be used more and it would be interesting to see larger graphs relating the conferences this season.

I'm interested to know if you automated this process?  I think the use of the graph in the college football sense.  I think in order for you to do it for all college football you would have to have an automated procedure to avoid mistakes and obviously save time.  I know there are a lot of computer scientists on this site. I think this could really be an interesting computerized metric in college football.

I've created graphs like these with an open source tool called Graphviz, a sweet free open source tool.  And yes, there are fairly easy ways to automate it.

This is one of the most interesting diaries filled with graphs? Graphs. that I have read in quite a while.

Good work on this diary, I appreciate it and it's given me another fascinating metric to chew on while we await the next word(s) from Dave Brandon. Also, I like how you placed and related the two graphs together, and the picture that the "strong" graph seems to paint. Again, excellent work and thank you for contributing it to this board.

Since only 8 teams are directly faced from the conference each season and the shortest path to success is to actually play a team and beat them, then I think what you are suggesting is that if we only added one more team to the conference, then divided the conference into two divisions, then we could make sure everyone in their division played everyone else every year, plus 3 teams in the other division, then we could always exactly pick to two best teams to play a final championship game at the end of the year that would be the undeniable champion and end all arguing for-ever!?!

Shit, that just might work.

Nah, we would still find some way to claim the wins Michigan got weren't really good wins, and while the offense seems exciting, really sucks because Denard drops the ball and Tate throws it up for grabs all the time, and shifting to a 3-3-5 confused all of the 5 star talent on the defense so they performed like 2 star talent that can't even tie the shoes of the Indiana players girlfriends, and our special teams suck, not because we're using up all the redshirt freshman on Defense instead of special teams where they normally play, but because we're using true freshman and an assortment of players who suck but show up to practice and workouts all year long anyway because this athletic scholarship was the only way they could even dream of getting a degree from a Univeristy like Michigan, or probably any University at all.

yep, we should probably just keep whining.  Cause that's what we learned during out time getting a degree at Michigan.

dang, we suck too.

I had a professor who was working on generalized graph theory and ways of bounding the size (and number of) cycles in arbitrarily sized tournaments. It's cool stuff.

I'm curious about the relationship between average path length and the threshold you used (margin of victory). The graph is strongly connected, sure, but it relies heavily on two paths (Minnesota over Iowa and Indiana over Purdue) to get this quality (and both of these paths rely on a 3 point margin of victory). Considering that this isn't a tournament, removing these paths might punish some teams arbitrarily simply because the path between two teams that didn't play may now be much longer (but this is not a metric of their relative quality!).

That notwithstanding, that's a pretty strong ranking. It's objective, sure, and you can poke some holes in it (as I have attempted to do), but from a subjective point of view it certainly passes the eyeball test. In the quarter break I may try to write software to examine an expanded graph; that could be pretty interesting.

I agree that there is room for error if the number of teams that you don't play approaches or exceeds the number of teams that you do play. However, if a team did not play Purdue, there are likely a number of potential teams that did beat Purdue to give you a 2-branch path. For example, Indiana beat Purdue by 3 points, which erases that branch. Penn State beat Indiana and can no longer use that branch. However, Penn State beat Northwestern, who beat Purdue, so they can use that to achieve the same result that Indiana would give them.

I have been thinking about something related to this graph theory for a while, but to see this article eventually, I have to say it's NICE WORK! Well, to the very least the circles are fun to search for and also we got another theory on how bad we suck this year.

A way to incorporate the idea of "strong wins" into your first set of rankings: give the edges weights inversely proportional to margin of victory (so blowout wins are "shorter" than close wins) and then look for the shortest path.

I am a nerdy engineer so I enjoy these kinds of things. Especially when applied to Michigan Football.

I like it.  Front page material?

So, what you have proven is the saying, "Nobody goes through the B10 schedule undefeated?"

I like the way you present and explain the information.

Another interesting thing about this method is that it doesn't give you the traditional problems that you would get if two teams played each other twice (once in a CG or Bowl) and both won one game. This would give both teams the benefit of the doubt and decrease their path length to 1. It means less in a conference ranking, but in on a national scale, it could be huge for the team that lost the first matchup but won the second one.

I've heard about stuff like this before but haven't ever seen anyone explain it in a way I could follow. Nice job.

it tells me what i knew which is that in the Big Ten you don't get unexpected lop sided losses.

Out here where I live in Pac ten country it seems to happen all the time.  Check out a string from this year

USC 48 - Cal 14, Cal 50 - ASU 17, ASU 42-WSU 0, WSU 31 - OSU 14, OSU 36-USC 7

every one is a strong victory and in just 5 games USC beats USC by 155 points!   here is another

Wash 24 UCLA 7, UCLA 42 WSU 28, WSU 31 OSU 14, OSU 35 Cal 7, Cal 50 ASU 17, ASU 24 Wash 14.

This kind of thing just doesn't happen in the Big Ten (as you showed)