-
Notifications
You must be signed in to change notification settings - Fork 0
Home
The only module needed to work with Fer objects is from sympy.combinatorics.permutations import Permutation
.
First, import the class from Feasible-edge-replacements import feasible-edge-replacements as Fer
.
Instantiate an object by calling the constructor: fer1 = Fer(old_edge={0,1}, new_edge={0,2}, permutation=Permutation(1,2))
. The parameters old_edge
and new_edge
must be sets (not tuples, as networkX
users might be accustomed to), otherwise a TypeError
will warn the user. The parameter permutation
can be left out (default is None
), but most operations will not make sense in this case. It is also possible to create a Fer object with an existing sequence.
Printing a Fer object outputs a string in the format (1 2) : (0 1 -> 0 2)
.
Two Fer objects may be multiplied, fer1*fer2
. This correctly produces a new Fer object, with the permutation corresponding to the product, and concatenates the sequence of edge-replcaments, updating the labels. The method __mult__
also attempts to simplify (i.e. shorten) the resulting sequence by removing consecutive edge-replacements that cancel each other out or that become trivial. Important to note: When applied to a networX
graph object, unlike most of abstract algebra literature, the product of Fer objects is always interpreted left-to-right. That is, fer1
acts first, followed by fer2
.
Fer objects can also be iterated, indexed, texified, and added to an integer to shift all labels.
In addition to the previous classes, we need to import networkx as nx
.
.ipynb file coming soon...
Coming soon...