# Lattice of Subgroups II - Coloring Vertices

In my previous post, I showed how to use Sage to generate the subgroup lattice of a group, and define labels for the subgroups. In this post, I’ll demonstrate how to color subgroups with different colors according to some desired property. If you’re not interested in code, scroll to the bottom of the post for a visual collection of groups and their subgroup lattices. First, let’s rerun the code from the previous post. We’ll choose a group we like and generate its poset.

(The Sage cells in this post are linked, so things may not work if you don’t execute them in order.)

## Normal subgroups

Now suppose we wish to know which subgroups are normal. We can do so with the following:

Coloring takes place after labelling, so when we’re defining the color dictionary, we have to use the (re)labelled vertices rather than the original vertices. Hence the use of `label[x]` instead of just `x`.

Here are some more examples. They’re all just variations of the above.

## Abelian subgroups and the center

Let’s say we want to highlight the abelian subgroups, with special emphasis on the center of the group. We can do this with a slight modification to the color dictionary:

## Maximal subgroups and the Frattini subgroup

The Frattini subgroup is the intersection of all the maximal subgroups of \$G\$. We can see this by highlighting the Frattini and maximal subgroups.

Sage has a built-in function for getting the Frattini subgroup. To get the maximal subgroups, however, we’ll have to find the elements covered by the greatest element (or top) of the poset \$P\$.

## Sylow subgroups

Getting the Sylow \$p\$-subgroups takes a little more work, since Sage doesn’t have a single function that generates all the Sylow subgroups at once.

In Sage, `G.sylow_subgroup(p)` returns one Sylow \$p\$-subgroups. To get all the Sylow \$p\$-subgroups, we could take all conjugates of this Sylow subgroup (since all Sylow \$p\$-subgroups are conjugate). A faster way, however, is to use the fact that the cardinality of all Sylow \$p\$-subgroups is the maximal \$p^{th}\$ power dividing the order of \$G\$.

# More examples

In the next post, we’ll look at labelling edges. This is particularly useful if we want to determine if \$G\$ has subgroup series with certain properties.

Written on December 17, 2014