A node may specify different logical locations for links to connect. The logical locations are called "ports". You can think of the graph as a motherboard, the nodes as integrated circuits and the edges as the connecting wires. Then, the pins on the integrated circuits correspond to the node ports. The node ports are declared by port elements as children of the corresponding node. Each port element must have an XML-Attribute name which is the identifier for this port. The edge element has optional XML-Attributes sourceport and targetport with which an edge may specify the port on the source, resp. target, node. Correspondingly, the endpoint element has an optional XML-Attribute port.
If a GML with ports is used as a data provider for Viusalizer or Diagrammer, an anchor descriptor is internally created for each node describing its anchors. The links are automatically connected to their corresponding ports.The following example describes a GML with ports:
<?xml version="1.0" encoding="UTF-8"?> <graphml xmlns="http://graphml.graphdrawing.org/xmlns" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns http://graphml.graphdrawing.org/xmlns/1.0/graphml.xsd"> <graph id="G" edgedefault="directed"> <node id="n0"> <port name="North"/> <port name="South"/> <port name="East"/> <port name="West"/> </node> <node id="n1"> <port name="Nort>"/> <port name="South"/> <port name="East"/> <port name="West"/> </node> <node id="n2"> <port name="NorthWest"/> <port name="SouthEast"/> </node> <node id="n3"> <port name="NorthEast"/> <port name="SouthWest"/> </node> <edge source="n0" target="n3" sourceport="North" targetport="NorthEast"/> </graph> </graphml>