0
$\begingroup$

Based on below command:

  Graph[{1 \[UndirectedEdge] 2, 2 \[UndirectedEdge] 3, 
 3 \[UndirectedEdge] 1, 1 \[UndirectedEdge] 4, 3 \[UndirectedEdge] 4,
 2 \[UndirectedEdge] 4, 3 \[UndirectedEdge] 5, 
 5 \[UndirectedEdge] 6, 4 \[UndirectedEdge] 6, 3 \[UndirectedEdge] 6,
  4 \[UndirectedEdge] 5}, 
  VertexCoordinates -> {{0, 0}, {0, 1}, {1, 1}, {1, 0}, {2, 1}, {1, 
    2}, {2, 2}}]

we can draw a graph as enter image description here

Mathematica does its job feasibly. However for input of several programs we have to use a file with xml format. For instants, the above created graph via commands defined in xml format have to be written as below which is encapsulated in ah "file.xml".

 </LATTICES>

<LATTICE name="sqd" dimension="2">
  <PARAMETER name="a" default="1"/>
  <BASIS>
     <VECTOR>a 0</VECTOR>
     <VECTOR>0 a</VECTOR>
 </BASIS>
</LATTICE>


<UNITCELL name="unicross" dimension="2">
  <VERTEX id="1" ><COORDINATE> 0   0 </COORDINATE></VERTEX>
  <VERTEX id="2" ><COORDINATE> 0   1 </COORDINATE></VERTEX>
  <EDGE ><SOURCE vertex="1"/><TARGET vertex="2"/></EDGE>
  <EDGE ><SOURCE vertex="1"/><TARGET vertex="1" offset="1 0"/></EDGE>
  <EDGE ><SOURCE vertex="2"/><TARGET vertex="2" offset="1 0"/></EDGE>
  <EDGE ><SOURCE vertex="1"/><TARGET vertex="2" offset="1 0"/></EDGE>
  <EDGE ><SOURCE vertex="2"/><TARGET vertex="1" offset="1 0"/></EDGE>
</UNITCELL>

<LATTICEGRAPH name = "sqdcross" >
 <FINITELATTICE>
   <LATTICE ref="sqd"/>
   <PARAMETER name="W" default="1"/>
   <PARAMETER name="L" default="2"/>
   <EXTENT dimension="1" size="L"/>
   <EXTENT dimension="2" size="W"/>
   <BOUNDARY dimension="1" type="periodic"/>
   <BOUNDARY dimension="2" type="open"/>
  </FINITELATTICE>
 <UNITCELL ref="unicross"/>
</LATTICEGRAPH>

</LATTICES>

In the unitcell, two vertices is defined at coordinate {0,0} and {0,1}. With W=1 this unitcell is not repeated in the vertical direction and with L=2 it is allowed to grow horizontally to construct another cell. Albeit with periodic condition in this direction we have two additional vertices at the end of the graph. In the part of unitcell we defined the vertices and edges as we expected from the graph.

Although I do not know how to draw the graph nexus to the xml file. In fact, how can I check the output of the xml graph is according to what was extracted from Mathematica?

$\endgroup$
2
  • $\begingroup$ considered GraphML or GXL? $\endgroup$ Commented Mar 3, 2020 at 12:52
  • $\begingroup$ I'm sorry but your 'Graph' will not be shown because of a seventh Vertex which isn't used. And the VertexCoordinates do not create your graph picture. $\endgroup$ Commented Mar 29, 2020 at 10:26

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.