Skip to content

Commit 62a5258

Browse files
authored
Merge pull request #1174 from szoupanos/links_doc
Adding documentation on link types
2 parents 7e14d16 + a70113e commit 62a5258

File tree

2 files changed

+79
-0
lines changed

2 files changed

+79
-0
lines changed

docs/source/link_types/index.rst

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
Node classes
2+
------------
3+
There are two *Node* sub-classes, *Data* and *Calculation*. The *Code* nodes
4+
can be considered as sub-classes of *Data* nodes. *JobCalculations*,
5+
*InlineCalulations* and the *WorkCalculations* are subclasses of the
6+
*Calculation* class.
7+
8+
AiIDA graph
9+
-----------
10+
The AiIDA graph is a `directed graph <https://en.wikipedia.org/wiki/Directed_graph>`_.
11+
The links of the graph are arrows connecting two nodes. An arrow (x, y) is
12+
considered to be directed from x to y; y is called the **head** and x is called
13+
the **tail** of the arrow; y is said to be a **direct successor** of x and x
14+
is said to be a **direct predecessor** of y. If a path leads from x to y, then
15+
y is said to be a **successor** of x and reachable from x, and x is said to be a
16+
**predecessor** of y. The arrow (y, x) is called the inverted arrow of (x, y).
17+
18+
AiiDA links
19+
-----------
20+
The following table summarises the available AiiDA links and their properties.
21+
Each line of the table corresponds to a different link, it mentions the tail
22+
of the arrow (from column), the head of the arrow (to column) and finally
23+
the constraints that are related to the label of the link and the nodes involved.
24+
25+
========= =================== ================= ==========================================
26+
Link type Tail of link (from) Head of link (to) Unique condition (combinations that should
27+
be unique in the link table)
28+
========= =================== ================= ==========================================
29+
INPUT Data Calculation (head Calculation node, link label)
30+
CREATE Calculation Data (head Data node)
31+
RETURN Calculation Data (tail Calculation node, label)
32+
CALL Calculation Calculation (head Calculation node)
33+
========= =================== ================= ==========================================
34+
35+
36+
There are four different links available: **INPUT**, **CREATE**, **RETURN**
37+
and **CALL**.
38+
39+
* The **INPUT** link is always from a *Data* node (tail of the link) to
40+
a *Calculation* node (head of the link). The unique constraint means that
41+
each *Calculation* node can have only one input *Data* node with given label
42+
(i.e., a calculation cannot accept two inputs with the same label).
43+
44+
* The **CREATE** link is always from a *Calculation* node (tail of the link)
45+
to a *Data* node (head of the link). The unique constraint means that each
46+
*Data* node can be created by one and only one *Calculation* node.
47+
48+
* The **RETURN** link is always from a *Calculation* node (tail of the link)
49+
to a *Data* node (head of the link). The unique constraint means that a
50+
*Calculation* cannot return two or more *Data* nodes with the same label. Code
51+
implementation detail: For the moment there is always and only a **CREATE**
52+
link from a *JobCalculation* to the generated *Data*. A **RETURN** link is
53+
implied with the conditions of a **RETURN** link (the implementation will be
54+
corrected to comply shortly).
55+
56+
* The **CALL** link is always from a *Calculation* to another *Calculation*
57+
node. A given *Calculation* node cannot be called by more than one
58+
*Calculation* node. In practice, the caller cannot be a *JobCalculation* but
59+
it is always a *WorkCalculation*. Instead called calculations can be of any
60+
subclass of *Calculation*.
61+
62+
Graph navigation
63+
----------------
64+
The links can be followed in both possible directions (forward & reverse) using
65+
the QueryBuilder. This requires to define additional “names” for each direction
66+
of the link, and they are documented at the
67+
:doc:`QueryBuilder section <../querying/querybuilder/usage>`. For example,
68+
if there is an **INPUT** link from data D to calculation C, D is the
69+
“input_of” C, or equivalently D is the “output_of” C. Currently, in the
70+
QueryBuilder, input_of and output_of refer to any link type, where C is the
71+
head of the arrow and D is the tail.

docs/source/working_with_aiida/index.rst

+8
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,14 @@ Interfaces have been written for some of the most used schedulers.
128128

129129
../scheduler/index
130130

131+
==========
132+
Link types
133+
==========
134+
135+
.. toctree::
136+
:maxdepth: 4
137+
138+
../link_types/index.rst
131139

132140
=============
133141
Querying data

0 commit comments

Comments
 (0)