Skip to content

Automorphisms

Jordan Matelsky edited this page Dec 14, 2021 · 3 revisions

DotMotif can be instructed to automatically handle automorphisms or not, depending on your use-case. For example, in the following graph:

(A) -> (C) <- (B)

With the following motif:

x -> y

You may want to get the following results:

x y
A C
B C

Or you may wish to only receive one representation of the automorphism set:

x y
A* C

* Here, A may equally likely be replaced with B.

In order to indicate to DotMotif that you would like one behavior or the other, you can do one of two things:

Using the exclude_automorphisms flag

You can pass the exclude_automorphisms flag to the dotmotif constructor. The default is False: In other words, all automorphisms are included:

Default Behavior

Graph:

A -> B
B -> C
C -> A

Motif (the same text):

A -> B
B -> C
C -> A

Here, E is an executor (it does not matter which flavor; let's imagine it's a NetworkXExecutor, for example):

>>> E = NetworkXExecutor()
>>> motif = dotmotif().from_motif("triangle.motif")
>>> len(E.find(motif))
3

With exclude_automorphisms set to True:

>>> E = NetworkXExecutor()
>>> motif = dotmotif(exclude_automorphisms=True).from_motif("triangle.motif")
>>> len(E.find(motif))
1

Using the === automorphism operator

The === operator is the automorphism operator in the DotMotif syntax. You can use it to indicate that two nodes are isomorphic:

A -> B
B -> C
C -> A

A === B
B === C

In the above example, we indicate that we do not care about the order of triangle nodes. (We do not need to include A===C because the DotMotif automorphism operator is transitive and symmetric.)