Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import itertools
- def raag(G):
- # the default notion of raag is backwards...
- return RightAngledArtinGroup(G.complement())
- def words(G):
- """
- A lazy list of all the words in the generators of G
- """
- gens = list(G.gens()) + [g.inverse() for g in list(G.gens())]
- i = 1
- while 1:
- for g in itertools.product(*([gens] * i)):
- yield g
- i += 1
- def extensionGraph(G, n=10):
- """
- Kim and Koberda define the 'extension graph' and give a related conjecture, which we're testing.
- The conjecture is that raag(G) embeds in raag(H) if and only if G embeds in extension(H),
- and is stated in their paper "embedability between right angled artin groups"
- @n controls how big we want this finite approximation to extension(G) to be.
- """
- AG = raag(G)
- gens = list(AG.gens())
- colors = {gens[i]: rainbow(len(gens))[i] for i in range(len(gens))}
- new_vertices = list(AG.gens())
- color = {colors[g]: [g] for g in gens}
- for g in itertools.islice(words(AG),n):
- g = product(list(g))
- for v in gens:
- x = g*v*g.inverse()
- if x not in new_vertices:
- new_vertices.append(x)
- color[colors[v]] += [x]
- return (Graph([new_vertices, lambda x,y: x*y == y*x and x != y]), color)
- def monadGraph(G, n=10, onlyPrimitive=True):
- """
- Send G to comm(raag(G))
- @n controls how big we want the finite approximation to be
- @onlyPrimitive will filter out only the primitive elements
- of the graph. Each of these corresponds to a complete countable
- graph given by its powers. But if you want an embedding, you
- can only pick one vertex from each of these clusters, so for
- clarity of the image, we might as well only show one.
- """
- AG = raag(G)
- gens = list(AG.gens())
- colors = {gens[i]: rainbow(len(gens))[i] for i in range(len(gens))}
- new_vertices = list(AG.gens())
- color = {colors[g]: [g] for g in gens}
- color['white'] = []
- for g in itertools.islice(words(AG),n//2): # make the conjugates be of about the right length
- g = product(list(g))
- for v in gens:
- x = g*v*g.inverse()
- if x not in new_vertices:
- keep = True
- if onlyPrimitive:
- for (seen, i) in itertools.product(new_vertices,range(-n,n+1)):
- if seen^i == x:
- keep = False
- break
- if keep:
- new_vertices.append(x)
- color[colors[v]] += [x]
- for g in itertools.islice(words(AG),n):
- g = product(list(g))
- if g not in new_vertices:
- keep = True
- if onlyPrimitive:
- for (seen, i) in itertools.product(new_vertices, range(-n,n+1)):
- if seen^i == g:
- keep = False
- break
- if keep:
- new_vertices.append(g)
- color['white'] += [g]
- return (Graph([new_vertices, lambda x,y: x*y==y*x and x != y]), color)
- def testGraph(G,n):
- """
- Show both the extension graph and the monad graph to compare them.
- """
- Gex, ecol = extensionGraph(G,n)
- CAG, mcol = monadGraph(G,n)
- print("extension graph")
- show(Gex.plot(vertex_colors=ecol, vertex_size=50, iterations=20000))
- print("monad graph")
- show(CAG.plot(vertex_colors=mcol, vertex_size=50, iterations=20000))
- # An example of interest -- this is the counterexample from Cassals-Ruiz, Duncan, Kazachkov:
- Gamma = Graph([['a1','a2','b','c','d','e'],[('a1','a2'),('a1','d'),('a1','e'),('a2','d'),('a2','e'),('d','e'),('c','d'),('c','a1'),('b','e'),('b','a2')]])
- # this renders the graph in a way that is almost illegible.
- testGraph(Gamma, 50)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement