GraphML file format

The tool stores temporal networks as GraphML, an XML format for directed graphs. A GraphML file carries the network topology (nodes and directed edges) together with the temporal-network data that belongs to the graph, a node, or an edge.

GraphML is used because it is an open, XML-based interchange format: a file can be edited by hand, produced by another program, and opened in the editor. The filename extension is a useful convention, but the NetworkType data in the file states the kind of network.

Structure

The header declares every data item with a <key> element. The <graph edgedefault="directed"> element then contains graph-level <data> items, <node id="..."> elements, and <edge id="..." source="..." target="..."> elements. Node and edge identifiers must be unique; every edge endpoint must name an existing node.

Each key declaration includes a default. If a <data> element is absent, the reader uses that key's declared default; if the key itself is absent, it uses the fallback described below. Empty optional values are normally omitted by the writer. Files produced by older versions are accepted for the legacy edge types normal and constraint, which mean requirement.

The writer declares only the keys meaningful for the selected network type. STN, STNU, OSTNU, CSTN, CSTNU, CSTNPSU (also called FTNU), PCSTNU, and PSTN are supported. Thus, the absence of a key can be intentional: for example, an STN has Value, while a CSTN has LabeledValues instead.

Graph keys

Key Written for Meaning and value format Default
NetworkType all Network kind: STN, STNU, OSTNU, CSTN, CSTNU, CSTNPSU, PCSTNU, or PSTN. CSTNU
Name all Human-readable graph name. empty
nVertices all Number of nodes, as an integer. 0
nEdges all Number of edges, as an integer. 0
Annotations all Optional editor notes: one line per note, x<TAB>y<TAB>width<TAB>height<TAB>base64-utf8-text. empty
CheckOutcome all A check assertion: kind|successful|algorithm|toolVersion, where kind is CONSISTENCY, DYNAMIC_CONSISTENCY, DYNAMIC_CONTROLLABILITY, or AGILE_CONTROLLABILITY (the last is what OSTNU checks), and successful is true or false. empty
DispatchabilityOutcome all A separately derived representation: DISPATCHABLE|algorithm or MINIMAL|algorithm. Its absence means no representation is stored. empty
OutcomeFingerprint all The sha256:v1:<hex> fingerprint of the network protected by the two outcome values. empty
nContingent STNU, PSTN, CSTNU, CSTNPSU, PCSTNU Number of contingent nodes, as an integer. 0
nObservedProposition OSTNU, CSTN, CSTNU, CSTNPSU, PCSTNU Number of observed propositions, as an integer. 0

The count keys describe the file and are written by the tool. When producing a file yourself, keep them consistent with its contents.

Stored outcomes

CheckOutcome and DispatchabilityOutcome are assertions made by the program that saved the file; they are independent. The first records a consistency or controllability result, while the second records a dispatchable or minimal representation. Both are used only when OutcomeFingerprint is present, has a supported version, and matches the network as read. If the network was changed, the fingerprint is unknown, or it does not match, the tool silently ignores both values and loads the network normally.

The tool writes CheckOutcome when a check completes, whether the verdict is positive or negative, and writes DispatchabilityOutcome whenever it produces a dispatchable or minimal representation. Both are dropped as soon as the network is modified. So their absence never means “false” — it means “not known”: no completed check backs a claim about this network as it currently stands. Do not write either key by hand without also computing a matching OutcomeFingerprint; a stale or hand-written pair that happens to match would be believed.

Node keys

Key Written for Meaning and value format Default
x, y all Visual position, each a decimal number. 0
Obs OSTNU, CSTN, CSTNU, CSTNPSU, PCSTNU Proposition observed at the node: one proposition character. empty
Label CSTN, CSTNU, CSTNPSU, PCSTNU Node label: a conjunction such as p, ¬p, or p¬q; is the empty label.
Potential OSTNU, CSTN, CSTNU, CSTNPSU, PCSTNU Labeled potentials: {(nodeName, integer, label) ...} or {}. Names are written without case conversion. empty
Parameter PCSTNU, or any graph containing a parameter node true for a parameter node; omit it for other nodes. empty (read as false)
LogNormalDistribution PSTN Distribution parameters: LogNormalDistributionParameter[location=..., scale=...]. empty

Edge keys

Key Written for Meaning and value format Default
Type all requirement, contingent, derived, or internal. requirement
Route all Optional visual route: one or two t,offset control points separated by ;, with 0 < t < 1; offset is a multiple of the source-to-target chord length. empty (automatic route)
Value STN, STNU, OSTNU, PSTN Ordinary integer edge value. empty
LabeledValue STNU, OSTNU, PSTN One case value: LC(nodeName):integer or UC(nodeName):integer. empty
LabeledValues OSTNU, CSTN, CSTNU, CSTNPSU, PCSTNU Set of conditional values: {(integer, label) ...} or {}; for example {(8, p) (6, ¬q) }. empty
UpperCaseLabeledValues OSTNU, CSTNU, CSTNPSU, PCSTNU Set of upper-case conditional values: {(nodeName, integer, label) ...} or {}. empty
LowerCaseLabeledValues OSTNU, CSTNU, CSTNPSU, PCSTNU Lower-case conditional value(s), in the same triple form {(nodeName, integer, label) ...} or {}. empty

In labels, juxtaposition means conjunction and ¬ negates a proposition. The empty set is {}; the empty label is . The reader also accepts the historical triple order (label, nodeName, integer) for upper- and lower-case maps, but new files should use the order shown in the table.

Contingent links

A contingent link (A, x, y, C) is not one edge. It is a pair of directed, contingent edges: the lower-case value is on A → C, and the upper-case value is on C → A. In initialized form, write LC(C):x on A → C and UC(C):-y on C → A. The node named in both case labels is the contingent endpoint C.

The reader also accepts the initial (not yet initialized) form: Value y on A → C and Value -x on C → A. Both edges are required in either form. Do not put both halves on one edge, and do not reverse the endpoints: this is the most common source of malformed STNU files.

Complete examples

These are real repository instances, shortened only to their essential complete GraphML content. They were selected from CstnuTool/Instances/stn01.stn, src/test/resources/testGraphML.stnu, and CstnuTool/Instances/ex2C_checked_DC.cstn.

Minimal STN

<?xml version="1.0" encoding="UTF-8"?>
<graphml xmlns="http://graphml.graphdrawing.org/xmlns/graphml">
  <!-- The declarations make omitted data use these defaults. -->
  <key id="NetworkType" for="graph"><default>CSTNU</default></key>
  <key id="Name" for="graph"><default></default></key>
  <key id="x" for="node"><default>0</default></key>
  <key id="y" for="node"><default>0</default></key>
  <key id="Type" for="edge"><default>requirement</default></key>
  <key id="Value" for="edge"><default></default></key>
  <graph edgedefault="directed">
    <data key="NetworkType">STN</data>
    <data key="Name">stn01.stn</data>
    <node id="A1"><data key="x">259.0</data><data key="y">214.0</data></node>
    <node id="X1"><data key="x">372.0</data><data key="y">465.0</data></node>
    <!-- A directed requirement bound from A1 to X1. -->
    <edge id="eA1-X1" source="A1" target="X1">
      <data key="Type">requirement</data><data key="Value">-1</data>
    </edge>
  </graph>
</graphml>

STNU contingent link, initialized form

<?xml version="1.0" encoding="UTF-8"?>
<graphml xmlns="http://graphml.graphdrawing.org/xmlns/graphml">
  <key id="NetworkType" for="graph"><default>CSTNU</default></key>
  <key id="x" for="node"><default>0</default></key>
  <key id="y" for="node"><default>0</default></key>
  <key id="Type" for="edge"><default>requirement</default></key>
  <key id="LabeledValue" for="edge"><default></default></key>
  <graph edgedefault="directed">
    <data key="NetworkType">STNU</data>
    <data key="nContingent">1</data>
    <node id="X"><data key="x">0.0</data><data key="y">0.0</data></node>
    <node id="Y"><data key="x">0.0</data><data key="y">0.0</data></node>
    <!-- X is A and Y is C: lower bound x = 2. -->
    <edge id="XY" source="X" target="Y"><data key="Type">contingent</data><data key="LabeledValue">LC(Y):2</data></edge>
    <!-- The reverse edge carries the negated upper bound -y = -5. -->
    <edge id="YX" source="Y" target="X"><data key="Type">contingent</data><data key="LabeledValue">UC(Y):-5</data></edge>
  </graph>
</graphml>

CSTN labeled values

<?xml version="1.0" encoding="UTF-8"?>
<graphml xmlns="http://graphml.graphdrawing.org/xmlns/graphml">
  <key id="NetworkType" for="graph"><default>CSTNU</default></key>
  <key id="Obs" for="node"><default></default></key>
  <key id="Label" for="node"><default>⊡</default></key>
  <key id="LabeledValues" for="edge"><default></default></key>
  <key id="Type" for="edge"><default>requirement</default></key>
  <graph edgedefault="directed">
    <data key="NetworkType">CSTN</data>
    <!-- A? observes proposition a; ⊡ means it is always present. -->
    <node id="A?"><data key="Obs">a</data><data key="Label">⊡</data></node>
    <node id="n1"><data key="Label">¬a</data></node>
    <!-- This edge has value 4 when a is false. -->
    <edge id="e0" source="A?" target="n1"><data key="Type">requirement</data><data key="LabeledValues">{(4, ¬a) }</data></edge>
  </graph>
</graphml>

Filename extensions

GraphML is the file content regardless of the extension. Common extensions are .stn, .stnu, .cstn, .cstnu, .cstnpsu (FTNU/CSTNPSU), .pcstnu, .ostnu, and .pstn; use the extension matching the declared NetworkType. A generic .graphml file is also valid, but does not communicate the intended network kind to a person or to file-selection filters.

Luke's plain format and converters

Luke Hunsberger's plain text format is useful for exchanging STN, STNU, and CSTN instances with tools that expect its section-based text representation. It does not preserve GraphML presentation data such as coordinates, routes, or annotations. Luke2GraphML converts supported plain STN, STNU (including ESTNU), and CSTN files to GraphML; GraphML2Luke exports an STNU GraphML file as .plainStnu. Use GraphML for editing and complete round trips, and the plain format when interoperating with software that specifically requests it.