In graph theory, the weak components of a directed graph partition the vertices of the graph into subsets that are totally ordered by reachability. They form the finest partition of the set of vertices that is totally ordered in this way.
The weak components were defined in a 1972 paper by Ronald Graham, Donald Knuth, and (posthumously) Theodore Motzkin, by analogy to the strongly connected components of a directed graph, which form the finest possible partition of the graph's vertices into subsets that are partially ordered by reachability. Instead, they defined the weak components to be the finest partition of the vertices into subsets that are totally ordered by
In more detail, defines the weak components through a combination of four symmetric relations on the vertices of any directed graph, denoted here as
u
v
u\Leftrightarrowv
u
v
v
\Leftrightarrow
u
v
u\parallelv
u
u
v
u ≈ v
u\Leftrightarrowv
\asymp
u\asympv
u ≈ … ≈ v
u
\asymp
\asymp
\asymp
\asymp
\Leftrightarrow
\asymp
\asymp
The original definition by Graham, Knuth, and Motzkin is equivalent but formulated somewhat differently. Given a directed they first construct another graph
\hatG
\hatG
G
Corresponding to these definitions, a directed graph is called weakly connected if it has exactly one weak component. This means that its vertices cannot be partitioned into two subsets, such that all of the vertices in the first subset can reach all of the vertices in the second subset, but such that none of the vertices in the second subset can reach any of the vertices in the first subset. It differs from other notions of weak connectivity in the literature, such as connectivity and components in the underlying unconnected graph, for which Knuth suggests the alternative terminology
If
X
Y
X
Y
Y
X<Y
X
This ordering on the weak components can alternatively be interpreted as a weak ordering on the vertices themselves, with the property that when
u<v
u
v
u
v
Every weak component is a union of strongly connected If the strongly connected components of any given graph are contracted to single vertices, producing a directed acyclic graph (the of the given graph), and then this condensation is topologically sorted, then each weak component necessarily appears as a consecutive subsequence of the topological order of the strong
An algorithm for computing the weak components of a given directed graph in linear time was described by, and subsequently simplified by and As Tarjan observes, Tarjan's strongly connected components algorithm based on depth-first search will output the strongly connected components in (the reverse of) a topologically sorted order. The algorithm for weak components generates the strongly connected components in this order, and maintains a partition of the components that have been generated so far into the weak components of their induced subgraph. After all components are generated, this partition will describe the weak components of the whole
It is convenient to maintain the current partition into weak components in a stack, with each weak component maintaining additionally a list of its, strongly connected components that have no incoming edges from other strongly connected components in the same weak component, with the most recently generated source first. Each newly generated strongly connected component may form a new weak component on its own, or may end up merged with some of the previously constructed weak components near the top of the stack, the ones for which it cannot reach all
Thus, the algorithm performs the following
S
S
S
W
S
S