Generic Diagram¶
Routines and class for all types of diagrams, inherited by others.
-
class
adg.diag.
Diagram
(nx_graph)[source]¶ Bases:
object
Describes a diagram with its related properties.
-
graph
¶ The actual graph.
Type: NetworkX MultiDiGraph
-
unsorted_degrees
¶ The degrees of the graph vertices
Type: tuple
-
degrees
¶ The ascendingly sorted degrees of the graph vertices.
Type: tuple
-
unsort_io_degrees
¶ The list of in- and out-degrees for each vertex of the graph, stored in a (in, out) tuple.
Type: tuple
-
io_degrees
¶ The sorted version of unsort_io_degrees.
Type: tuple
-
max_degree
¶ The maximal degree of a vertex in the graph.
Type: int
The tag numbers associated to a diagram.
Type: list
-
adjacency_mat
¶ The adjacency matrix of the graph.
Type: NumPy array
-
-
adg.diag.
check_vertex_degree
(matrices, three_body_use, nbody_max_observable, canonical_only, vertex_id)[source]¶ Check the degree of a specific vertex in a set of matrices.
Parameters: - matrices (list) – Adjacency matrices.
- three_body_use (bool) –
True
if one uses three-body forces. - nbody_max_observable (int) – Maximum body number for the observable.
- canonical_only (bool) –
True
if one draws only canonical diagrams. - vertex_id (int) – The position of the studied vertex.
>>> test_matrices = [[[0, 1, 2], [1, 0, 1], [0, 2, 0]], [[2, 0, 2], [1, 2, 3], [1, 0, 0]], [[0, 1, 3], [2, 0, 8], [2, 1, 0]]] >>> check_vertex_degree(test_matrices, True, 3, False, 0) >>> test_matrices [[[0, 1, 2], [1, 0, 1], [0, 2, 0]], [[2, 0, 2], [1, 2, 3], [1, 0, 0]]] >>> check_vertex_degree(test_matrices, False, 2, False, 0) >>> test_matrices [[[0, 1, 2], [1, 0, 1], [0, 2, 0]]]
-
adg.diag.
draw_diagram
(directory, result_file, diagram_index, diag_type)[source]¶ Copy the diagram feynmanmp instructions in the result file.
Parameters: - directory (str) – The path to the output folder.
- result_file (file) – The LaTeX ouput file of the program.
- diagram_index (int) – The number associated to the diagram.
- diag_type (str) – The type of diagram used here.
-
adg.diag.
extract_denom
(start_graph, subgraph)[source]¶ Extract the appropriate denominator using the subgraph rule.
Parameters: - start_graph (NetworkX MultiDiGraph) – The studied graph.
- subgraph (NetworkX MultiDiGraph) – The subgraph used for this particular denominator factor.
Returns: The denominator factor for this subgraph.
Return type: (str)
-
adg.diag.
feynmf_generator
(graph, theory_type, diagram_name)[source]¶ Generate the feynmanmp instructions corresponding to the diagram.
Parameters: - graph (NetworkX MultiDiGraph) – The graph of interest.
- theory_type (str) – The name of the theory of interest.
- diagram_name (str) – The name of the studied diagram.
-
adg.diag.
label_vertices
(graphs_list, theory_type)[source]¶ Account for different status of vertices in operator diagrams.
Parameters: - graphs_list (list) – The Diagrams of interest.
- theory_type (str) – The name of the theory of interest.
-
adg.diag.
no_trace
(matrices)[source]¶ Select matrices with full 0 diagonal.
Parameters: matrices (list) – A list of adjacency matrices. Returns: The adjacency matrices without non-zero diagonal elements. Return type: (list) >>> test_matrices = [[[0, 1, 2], [2, 0, 1], [5, 2, 0]], [[2, 2, 2], [1, 2, 3], [0, 0, 0]], [[0, 1, 3], [2, 0, 8], [2, 1, 0]]] >>> no_trace(test_matrices) [[[0, 1, 2], [2, 0, 1], [5, 2, 0]], [[0, 1, 3], [2, 0, 8], [2, 1, 0]]] >>> no_trace() Traceback (most recent call last): File "/usr/lib/python2.7/doctest.py", line 1315, in __run compileflags, 1) in test.globs File "<doctest __main__.no_trace[4]>", line 1, in <module> no_trace() TypeError: no_trace() takes exactly 1 argument (0 given)
-
adg.diag.
print_adj_matrices
(directory, diagrams)[source]¶ Print a computer-readable file with the diagrams’ adjacency matrices.
Parameters: - directory (str) – The path to the output directory.
- diagrams (list) – All the diagrams.
-
adg.diag.
propagator_style
(prop_type)[source]¶ Return the FeynMF definition for the appropriate propagator type.
Parameters: prop_type (str) – The type of propagators used in the diagram. Returns: The FeynMF definition for the propagator style used. Return type: (str)