Skip to content

Glossary

An adjacency list is a graph written as one line per node. Each line holds a node and its out-nodes, such as 1 -> [3, 4, 6].

In a tree or forest, a node a is an ancestor of a node b if a lies on the path from the root to b. Then b is a descendant of a. In this guide and in Graphity, a node is its own ancestor and its own descendant.

A basic block is a stretch of code that runs from top to bottom. No jump leads into it or out of it, except at its start and at its end. The nodes of a control-flow graph are basic blocks.

A biconnected component is a group of edges in which any two edges lie on a common cycle of the undirected reading. The group is as large as it can be. A biconnected component is also called a block. Its nodes stay connected if any one of them is removed.

In the undirected reading, a graph is bipartite if its nodes split into two sets so that every edge runs from one set to the other.

A breadth-first search (BFS) visits the nodes in the order of their distance from its start node. With several start nodes, the distance counts from the nearest one. The search visits the start nodes first, then the nodes one edge away, then those two edges away, and so on.

In the undirected reading, a bridge is an edge whose removal increases the number of connected components. An articulation point is a node whose removal does the same.

A condensed graph has one node for each group of a partition of the nodes. It has an edge g -> h wherever an edge of the original graph runs from a node in group g to a node in group h. Edges inside a group are left out. The edges from one group to another become one edge. The condensed graph of the strongly connected components is a DAG (directed acyclic graph).

A block is control dependent on a branch if the outcome of the branch decides whether the block runs.

A control-flow graph (CFG) is the graph of the paths that the execution of a function can take. It has a node for each basic block. It has an edge a -> b if execution can continue with block b after block a.

The CSR layout (compressed sparse row) is a way to store a graph in two arrays. One array holds the out-nodes of all nodes, node after node. The other holds the position where the out-nodes of each node start, followed by the number of edges. Graphity keeps every graph this way.

A cycle is a path of edges that leads from a node back to the same node, such as a -> b -> c -> a. The shortest cycle is a self-loop, which is an edge from a node to itself. In the undirected reading, a cycle uses no edge twice, and a -> b and b -> a count as one undirected edge. So going along an edge and back is no cycle.

A DAG (directed acyclic graph) is a directed graph without a cycle. Its nodes can be put in an order in which every edge points forward. Such an order is a topological order.

In a tree or forest, the depth of a node is the number of edges from the root to the node. A root has depth 0.

A depth-first search (DFS) goes from a node as deep along outgoing edges as it can before it turns back. The edges it meets are tree, back, forward or cross edges.

The distance from a node a to a node b is the number of edges on a shortest path from a to b. A node has distance 0 from itself. A node that is not reached has no distance.

The dominance frontier of a block d holds every block m such that d dominates an in-node of m but does not strictly dominate m. The iterated dominance frontier of a set of blocks starts with their dominance frontier. It then adds the dominance frontier of each block in it, and so on until no block is added.

A node d dominates a node n if every path from an entry to n passes through d. Every node dominates itself. A node d strictly dominates n if it dominates n and is not n. The nearest strict dominator of n is its immediate dominator. The immediate dominators form the dominator tree. A node p post-dominates n if every path from n to an exit passes through p.

The edge index is the number of an edge. The edges of a graph are numbered from 0 in the order of their source and then their target. Data on edges is kept in arrays indexed by edge index.

An entry of a graph is a node where the paths of interest start. In a control-flow graph, the entry is the block where the function starts. A graph can have several entries, such as the entry points of a program. An exit is a node where the paths of interest end. In a control-flow graph, an exit is a block where the function returns.

A leaf is a node without out-nodes: it has no outgoing edges. In a tree, a leaf is a node without children.

In a DAG, the level of a node is the number of edges on a longest path to it from a root node. Nodes of the same level of a DAG have no path between them. In a breadth-first search, the level of a node is its distance from the nearest start node.

In a control-flow graph, a loop is a set of blocks that execution can run through again and again. Every block of a loop lies on a cycle through its header. The body of a loop is its header with the other blocks of the loop. These include the blocks of the loops nested in it. Loops nest: a loop can lie in the body of another loop.

The header of a loop is the block through which the loop is entered. It is usually where the test of a for or while loop sits. A loop that can be entered at more than one block is irreducible. Graphity then takes as its header the one of these blocks that a depth-first search from the entry reaches first. The entries of a loop are the blocks at which execution can enter it from outside. They are its header and, in an irreducible loop, other blocks as well.

The lowest common ancestor (LCA) of two nodes is the deepest node that is an ancestor of both.

A mapping is a list that says which node or edge of the original graph each node or edge of a transformed graph comes from. A mapping can also go the other way round. A mapping is partial if some of its entries have no counterpart.

A natural loop is a loop that is entered only through its header. Every loop written with for or while is a natural loop.

A neighbor of a node is a node connected to it by an edge in either direction. It is an out-node or an in-node of that node.

The node ID is the number of a node. The nodes of a graph are numbered from 0 to the node count minus 1. Data on nodes is kept in arrays indexed by node ID.

The out-degree of a node is the number of its out-nodes. Its in-degree is the number of its in-nodes. Their sum is called the degree. It is the number of edges at the node, and a self-loop counts twice.

The out-nodes of a node a are the targets of its outgoing edges: the nodes b with an edge a -> b. Its in-nodes are the sources of its incoming edges. A GraphGraphGraphGraph stores the out-nodes of every node; a BiAdjacentGraphBiAdjacentGraphBiAdjacentGraphBiAdjacentGraph stores the in-nodes as well.

The outgoing edges of a node are the edges with the node as their source. Its incoming edges are the edges with the node as their target. A self-loop is both. In the API, they are called out-edges and in-edges.

In a tree or forest, the parent of a node is its single in-node. The node is a child of its parent.

A partition is a division of the nodes or the edges of a graph into groups. Each node or edge is in at most one group. A group is known by its group ID. The strongly connected components are a partition of the nodes. The biconnected components are a partition of the edges.

A path is a sequence of edges in which each edge starts where the one before it ends. It leads from the source of its first edge to the target of its last edge. A graph is a path if it is a tree in which every node has at most one out-node. Its edges then form one path through all its nodes. The empty graph counts as a path.

A node a reaches a node b if a path of edges leads from a to b. Every node reaches itself.

A root node is a node without in-nodes: it has no incoming edges. Examples are the root of a tree and the first steps of a plan.

A self-loop is an edge from a node to itself, such as a -> a.

An edge a -> b runs from its source a to its target b.

SSA form (static single assignment) is a form of code in which every variable is assigned exactly once. Where different assignments meet, a phi-node picks the value of the path that was taken.

Strong bridge and strong articulation point

Section titled “Strong bridge and strong articulation point”

A strong bridge is an edge whose removal increases the number of strongly connected components. A strong articulation point is a node whose removal does the same.

A strongly connected component (SCC) is a group of nodes in which every node reaches every other. The group is as large as it can be. Every node is in exactly one SCC. A node on no cycle is an SCC of its own.

A subgraph is a graph made of some of the nodes of a graph and edges between them. Graphity takes the subgraph induced by the nodes it keeps: every edge between them stays. It numbers the nodes of a subgraph anew from 0, in ascending order of their old node IDs. A mapping gives the old node ID of each new node.

The subtree of a node is the node with all its descendants. A preorder lists the nodes of a tree in the order in which a depth-first search from its root reaches them. Each node comes before the subtrees of its children, and these follow one after the other. The preorder of a forest lists one tree after the other. So every node comes before its descendants, and each subtree takes a range of consecutive positions.

A topological order is an order of the nodes of a DAG in which the source of every edge comes before its target.

The transitive closure of a graph has an edge u -> v wherever a path of one or more edges leads from u to v. A node has a self-loop in it exactly when the node lies on a cycle. The transitive reduction of a DAG keeps an edge u -> v only if no other path leads from u to v.

The transposed graph of a graph has the same nodes and every edge turned around: a -> b becomes b -> a. The nodes that reach a node in a graph are the nodes that it reaches in the transposed graph.

A forest is a graph without cycles in which every node has at most one in-node. This in-node is the parent of the node. So the edges point away from the root nodes. A tree is a forest with at most one root node. The empty graph counts as a tree. In the undirected reading, a forest is a graph without cycles. A tree in that reading is a forest that is connected. Graphity’s checks for them ignore self-loops.

A depth-first search meets four types of edges:

  • A tree edge leads to a node the search had not seen yet.
  • A back edge leads back to a node on the current path and closes a cycle.
  • A forward edge leads to a node that the search has already reached from the edge’s source along one or more tree edges.
  • A cross edge leads to a node that the search has already finished and that is neither an ancestor nor a descendant of the edge’s source.

The undirected reading treats a directed graph as if its edges had no direction. An edge a -> b connects a and b, and a -> b and b -> a count as one undirected edge. A self-loop is still a cycle of its own, but the methods for this reading ignore it. The checks for trees and forests do not count it. It is never a bridge, and it lies in no biconnected component. The one exception is the test for a bipartite graph: a self-loop makes a graph not bipartite.

A weakly connected component is a group of nodes that paths connect when the direction of the edges does not matter, as in the undirected reading. The group is as large as it can be. In a graph that stands for an undirected one, it is simply called a connected component.