-
Notifications
You must be signed in to change notification settings - Fork 4
The Graph class
This class stores information about graphs used in our condensed matter simulations. Since we need different pieces of information depending on the parameters of the system, the class members are:
-
AdjacencyList
A vector which stores pairs (a,b) - each pair is two vertices with an edge connecting them. Our graphs are not directed, so the ordering of vertices within the pairs is arbitrary -
Lattice Constant
The number of ways the particular graph can be embedded into the lattice -
Order
The number of "elements" (bonds or sites) in the graph -
Identifier
The global index describing the position of the graph among all the graphs which are relevant to the problem -
SubgraphList
A vector containing theIdentifier
s of the subgraphs of the current graph and a count of how many ways that graph is embeddable
Two classes inherit from Graph
: SiteGraph
and BondGraph
. SiteGraph
adds one member (Sites
), which lists the real-space coordinates of the vertices of the graph. BondGraph
adds one member as well (Bonds
), which lists the real-space coordinates of the end-points of the edges of the graph (so each Bonds
is a list of pairs of Sites
).
Both subclasses share many similar member functions:
-
Add[Site/Bond]
- inserts the relevant vertex or edge if it's not already present -
Remove[Site/Bond]
- deletes the relevant vertex or edge if it is present -
CheckFor[Site/Bond]
- determines whether the relevant vertex or edge is present -
[SiteDegree/BondCount]
- finds the number of vertices/edges adjacent to the relevant vertex/edge -
MakeCanonical
- transforms the graph into the "canonical" representation -
PrintGraph
- outputs information about the graph to standard out -
GenerateAdjacencyList
- determines which vertices are actually connected, gives each a single integer labelling, and constructs a connection list from these labellings -
FindLatticeConstant
- determines how many distinct embeddings of the graph exist in the lattice (under the dihedral group) -
==
- overloaded operator to determine if two graphs are isomorphic under the dihedral group -
=
- overloaded assignment operator
We also have functions to read and write the graphs from and to files. We dump the information about each graph directly after the next, and each member has its own line. They are written in the order:
-
Identifier
-
Order
-
LatticeConstant
-
[Sites/Bonds]
- the pairs/quartets are all written on one line -
AdjacencyList
- the pairs are all written on one line -
SubgraphList
- theIdentifier
s are all on one line with the occurrence number
Other non-class functions (many of which are overloaded to take into account different intermediate storage methods) include:
-
Construct[Site/Bond]BasedGraphs
- generates all site-based graphs on the lattice up to some order -
ConstructRectangularSiteGraphs
- generates all closed rectangles on the lattice in a site-based representation, up to somem x n
or overall ordero
-
FindSubgraphs
- finds all subgraphs of the graphs passed to it