/// <summary> /// Constructs a cyclic group /// </summary> /// <param name="order">The order of the cyclic group</param> /// <exception cref="InvalidGroupException">If the order of the cyclic group is not positive</exception> public CyclicGroup(int order) { if (order <= 0) { throw new InvalidGroupException("No cyclic group of negative order"); } Elements = new ExplicitSet <GroupElement <BigInteger> >(); for (BigInteger i = 0; i < order / 2; ++i) { ((ExplicitSet <GroupElement <BigInteger> >)Elements).Elements.Add( new GroupElement <BigInteger>(i, this)); } }
/// <summary> /// Create a new Dihedral group /// </summary> /// <param name="order">The order of the dihedral group</param> /// <exception cref="InvalidGroupException">If the order is not even or not positive</exception> public DihedralGroup(BigInteger order) { if (order % 2 != 0 || order <= 0) { throw new InvalidGroupException("No Dihedral group of odd order"); } Elements = new ExplicitSet <GroupElement <BigInteger[]> >(); for (BigInteger i = 0; i < order / 2; ++i) { Elements.Elements.Add(new GroupElement <BigInteger[]>(new[] { 0, i }, this)); Elements.Elements.Add(new GroupElement <BigInteger[]>(new[] { 1, i }, this)); } }
public FiniteGraph(ExplicitSet <N> nodes, ExplicitSet <Tuple <N> > neighbors) { this.nodes = nodes; this.neighbors = neighbors; }