Class Lattice1DGenerator<T>

  • All Implemented Interfaces:
    NetworkGenerator<T>

    public class Lattice1DGenerator<T>
    extends AbstractGenerator<T>
    Creates a n x 1 lattice where each vertex is incident to two neighbors (except at the edges if the lattice is non-toroidal.)

    Based on Jung Lattice1DGenerator

    Author:
    Nick Collier, Jung Project
    • Constructor Detail

      • Lattice1DGenerator

        public Lattice1DGenerator​(boolean toroidal,
                                  boolean symmetrical)
        Creates a Lattice1DGenerator.
        Parameters:
        toroidal - whether lattice wraps or not.
        symmetrical - whether the lattice is symmetrical (edges are bi-directional). Note this only matters for a directed network.
    • Method Detail

      • createNetwork

        public Network<T> createNetwork​(Network<T> network)
        Given an existing network, add edges to create a n x 1 lattice. The lattice dimension n is the number of nodes in the specified network.
        Parameters:
        network - the network to rewire
        Returns:
        the created network
      • downIndex

        protected int downIndex​(int currentIndex)