1 Introduction
One of the most important features of the marriage market or the college admissions problems is that (pairwise) stable outcomes can always be found efficiently using the celebrated Deferred Acceptance algorithm (Gale and Shapley, 1962). Efficient computation is key for practical applications of the Deferred Acceptance algorithm and its variants (Roth, 1984, Abdulkadiroğlu and Sönmez, 2003, Sönmez and Switzer, 2013, Hatfield and Kominers, 2014). Moreover, since in standard (onetoone) marriage markets or (manytoone) college admissions problems (pairwise) stable outcomes coincide with the core, there is no obvious need to select among various solution concepts.
However, in more complex, manytomany matching markets there are many different, yet economically natural and interpretable, solution concepts (Blair, 1988, Sotomayor, 1999, Echenique and Oviedo, 2006, Klaus and Walzl, 2009). For example, pairwise stable outcomes do not coincide with the core (Blair, 1988). What makes a good solution concept? At the very least, it should make falsifiable predictions. But in economics good solution concepts often derive their appeal for normative reasons: they have sensible properties and make intuitive sense in particular settings. Efficient computation can serve as one such desirable property. As Papadimitriou (2007, pp. 2930) argues:
The reason is simple: If an equilibrium concept is not efficiently computable, much of its credibility as a prediction of the behavior of rational agents is lost – after all, there is no clear reason why a group of agents cannot be simulated by a machine. Efficient computability is an important modelling prerequisite for solution concepts.
If agents cannot efficiently find certain deviations from an outcome in a matching market, then a stability concept that is based on these deviations may be too strong. On the other hand, if it is computationally hard to verify whether an outcome satisfying a particular solution concept exists then this limits the applicability of this solution concept for matching market design.
In this paper, we consider the computational complexity of various solution concepts in trading networks. A trading network is a matching market in which heterogeneous firms can sign many contracts that specify the terms of the trade, quality of the product, price etc. with their suppliers (upstream) and with their buyers (downstream). Following a seminal contribution by Ostrovsky (2008), we assume that agents’ preferences satisfy full substitutability, that is, upstream and downstream contracts are complements, but contracts on the same side are substitutes. Our model can capture not only wealth effects, but also distortionary frictions, such as sales taxes or bargaining costs (Fleiner, Jagadeesan, Jankó, and Teytelboym, 2017). Finding a solution concept with attractive computational as well as economic properties would allow trading networks to be deployed in a variety of empirical (Fox, 2017) and practical applications (Morstyn et al., 2018).
In our model, stable outcomes, i.e., those immune to arbitrary blocks by sets of firms, do not necessarily exist (Hatfield and Kominers, 2012).^{1}^{1}1Stable outcomes exist in supply chains in which no firm can be simultaneously upstream and downstream from another (Ostrovsky, 2008, Westkamp, 2010, Hatfield and Kominers, 2012). Stable outcomes also exist (and coincide with competitive equilibria) in a variant of our model with continuous prices and no distortionary frictions (Hatfield et al., 2013, Fleiner et al., 2017). Following Fleiner, Jankó, Tamura, and Teytelboym (2016), we first point out that outcomes satisfying trail stability, an extension of pairwise or chain stability (Ostrovsky, 2008), always exist and can be found in linear time (in the number of contracts) by an extension of the Deferred Acceptance algorithm (Theorem 1). Trailstable outcomes are immune to locally blocking trails (sequences of distinct contracts in which a buyer of one contract is the seller in the next). In a locally blocking trail, agents simultaneously accept pairs of upstream and downstream contracts along the trail but there must also be agents that “kick off” (and “complete”) the blocking trail by unilaterally offering (or “accepting”) a single downstream (or a single upstream) contract. Trail stability is an attractive solution concept: in a variant of our model with continuous prices and distortionary frictions, trailstable outcomes essentially coincide with competitive equilibrium outcomes (Fleiner, Jagadeesan, Jankó, and Teytelboym, 2017).
We then relax the requirement of locally blocking trails that agents can only make an upstream (downstream) offer following the receipt of a downstream (upstream) offer. Thus we allow agents to offer an upstream and a downstream contract simultaneously, forming blocking cycles. As a result, we consider the existence of pathorcyclestable outcomes which are immune to blocking sets in the form of paths (trails in which every agent is distinct) or cycles.^{2}^{2}2We do not suggest that pathorcycle stability has an intuitive economic interpretation. We use this solution concept to give the strongest computational complexity result possible and to reveal the structure of stable outcomes in flow networks. Pathorcyclestable outcomes do not always exist in trading networks. We show that the decision problem of whether a pathorcyclestable outcome exists is complete even in a flow network (Fleiner, 2014), which is a special case of a trading network (Theorem 2).^{3}^{3}3Garey and Johnson (1979) provide definitions of computational complexity classes used in this paper. The proof reduces the problem to the problem of partitioning a directed graph into two acyclic sets, which is known to be complete (Bokal et al., 2004). Since trading networks are more general than flow networks, it follows that the problem of deciding whether a pathorcyclestable outcome exists in a trading network is also hard. Therefore, the ability to coordinate upstream and downstream contract offers minimally renders the computational problem for existence intractable. Our result superficially resembles the problems of determining the existence of pairwise stable outcomes in twosided hospitalresident markets with couples (McDermid and Manlove, 2010), with sizes (Delacrétaz, 2019), or with multidimensional constraints (Delacrétaz et al., 2016): in these models, as in ours, finding stable outcomes is hard due to the presence of various constraints. However, as far we know, none of our results has appeared elsewhere in the literature.
Finally, we turn our attention to stable outcomes analyzed in the context of trading networks by Hatfield et al. (2015). While stable outcomes do not always exist in trading networks, Hatfield et al. (2015) show that in trading networks blocking sets can be decomposed into certain blocking trails (under a monotonicity condition). We first show that in flow networks stable outcomes coincide with pathorcyclestable outcomes (Theorem 3). It follows that deciding whether a stable outcome exists in a flow network is complete (Corollary 1). Finally, we show that even verifying that a particular outcome is (not) stable is complete (Theorem 4). The proof provides a reduction from the set partition problem, which is known to be (weakly) complete.
Section 2 introduces the full model of trading networks and the special case of flow networks (2.3). In Section 3, we introduce trail stability (3.1), pathorcycle stability (3.2), and stability (3.3), and state the main results about the computational complexity of finding outcomes that satisfy these solution concepts. Section 4 leaves an open question concerning another solution concept—weak trail stability—introduced by Fleiner, Jankó, Tamura, and Teytelboym (2016). Section 5 is a conclusion.
2 Model
Our notation follows Fleiner, Jankó, Tamura, and Teytelboym (2016).
2.1 Ingredients
In a trading network, there is finite set of agents (firms or consumers) and a finite set of contracts . A contract is a bilateral agreement between a buyer and a seller . Hence, is the set of firms associated with contract and, more generally, is the set of firms associated with contract set . Call and the sets of ’s upstream and downstream contracts – for which is a buyer and a seller, respectively. Clearly, and form a partition over the set of contracts which involve , since an agent cannot be a buyer and a seller in the same contract. A firm is a terminal seller if there are no upstream contracts for in the network and is a terminal buyer if the network does not contain any downstream contracts for . An agent who is either a terminal buyer or a terminal seller is called a terminal agent. In an acyclic trading network, no agent simultaneously buys and sells from another agent, even via intermediaries.
Every firm has a choice function , such that for any .^{4}^{4}4Since firms only care about their own contracts, we can write to mean . We say that choice functions of satisfy the irrelevance of rejected contracts (IRC) condition if for any and we have that (Blair, 1988, Alkan, 2002, Fleiner, 2003, Echenique, 2007, Aygün and Sönmez, 2013).
For any and , define the chosen set of upstream contracts
(2.1) 
which is the set of contracts chooses as a buyer when has access to upstream contracts and downstream contracts Analogously, define the chosen set of downstream contracts
(2.2) 
For brevity, we will also use , so means that if is offered upstream and downstream contracts and , respectively, then and are those among them that chooses (with and ). We also define the rejected sets of contracts and . An outcome is a set of contracts.
A set of contracts is individually rational for an agent if . We call set acceptable if is individually rational for all agents . For sets of contracts , we say that is acceptable if , i.e., if the agent chooses all contracts from set whenever she is offered alongside . Set of contracts is acceptable if is acceptable for all agents . Note that contract set is individually rational for agent if and only if it is acceptable.
2.2 Assumptions on choice functions
We can now state our key assumption on choice functions introduced by Ostrovsky (2008).
Definition 1.
Choice functions of are fully substitutable if for all and they are:


Sameside substitutable (SSS):


Crossside complementary (CSC):

Contracts are stitutable if every firm regards any of its upstream or any of its downstream contracts as substitutes, but its upstream and downstream contracts as complements. Hence, rejected downstream (upstream) contracts continue to be rejected whenever the set of offered downstream (upstream) contracts expands or whenever the set of offered upstream (downstream) contracts shrinks.
2.3 Special case: flow networks and flowbased choice functions
We first define flowbased choice functions.
Definition 2.
is flowbased if

whenever is a terminal agent, for any ;

whenever is not a terminal agent

has linearorder preferences over and linearorder preferences over , and

given access to upstream contracts and downstream contracts , a firm with flowbased choice function will choose its most preferred upstream contracts from according to and most preferred downstream contracts from according to where .

Since nonterminal agents with flowbased choice functions always pick the same number of upstream and downstream contracts, their preferences satisfy the socalled Kirchhoff equality.^{5}^{5}5Flowbased choice functions are a special case of “separable” choice functions (Fleiner, Jankó, Tamura, and Teytelboym, 2016). It is immediate that flowbased choice functions defined in this way are fully substitutable and satisfy IRC.
A flow network is a trading network in which there are exactly two terminal agents (and the remaining firms are nonterminal) and all choice functions are flowbased (Fleiner, 2014).^{6}^{6}6In fact, what follows is a simplification of Fleiner’s flow network model where all capacities have value 1 and flow values must be integral.
3 Solution concepts and their computational complexity
3.1 Trail stability
In order to explain our first solution concept, we first define a trail.
Definition 3.
A nonempty set of contracts is a trail if its elements can be arranged in some order such that holds for all where .
The following solution concept was introduced by Fleiner, Jankó, Tamura, and Teytelboym (2016).
Definition 4.
An outcome is trailstable if

is acceptable.

There is no trail , such that and

is acceptable for , and

is acceptable for whenever and

is acceptable for .
The above trail is called a locally blocking trail to .

Trail stability is a natural solution concept when firms interact mainly with their buyers and suppliers and deviations by arbitrary sets of firms are difficult to arrange. In a trailstable outcome, no agent wants to drop his contracts and there exists no sequence of consecutive bilateral contracts comprising a trail such that any intermediate agent who is offered a downstream (upstream) contract along the trail wants to choose it alongside the subsequent upstream (downstream) contract in the trail. Importantly, we require that the first (final) agent wants to unilaterally offer (accept) the first (final) contract in the trail.^{7}^{7}7The trail and the order of conditional acceptances can, of course, be reversed with offering the first upstream contract to seller and so on. For trail stability, we do not require that intermediate agents accept all the contracts along the locally blocking trail. Instead they are simply required to myopically accept pairs of upstream and downstream contracts as they appear along the trail. We strengthen this requirement in Section 4.
Fleiner, Jankó, Tamura, and Teytelboym (2016) proved that under full substitutability trailstable outcomes always exist in trading networks and, under certain conditions, have a familiar lattice structure. Trailstable outcomes may not be Paretoefficient. In a variant of our model with continuous prices, Fleiner, Jagadeesan, Jankó, and Teytelboym (2017) showed that whenever there are distortionary frictions, such as sales taxes, in the economy, trailstable outcomes essentially coincide with competitive equilibrium outcomes.^{8}^{8}8The First Fundamental Welfare Theorem can, of course, fail in the presence of distortionary frictions. Here we focus on the computational properties of trailstable outcomes.
Theorem 1 (Fleiner, Jankó, Tamura, and Teytelboym, 2016).
Suppose that in a trading network choice functions satisfy full substitutability and IRC. Then a trailstable outcome exists and can be found in time linear in the number of contracts.
The proof of Theorem 1 follows immediately from the proof of existence of trailstable outcomes provided by Fleiner, Jankó, Tamura, and Teytelboym (2016) and Adachi (2017). Trailstable outcomes are found by a generalized GaleShapley algorithm defined in Fleiner, Jankó, Tamura, and Teytelboym (2016). In the generalized GaleShapley algorithm, at least one contract is rejected at each step and since the number of contracts is finite, the number of steps required to find a trailstable outcome is bounded by the number of contracts.
3.2 Pathorcycle stability
The definition of trail stability requires that there be initial and final agents that would unconditionally offer or accept an upstream or a downstream contract while all the intermediaries only make a downstream (upstream) offer after receiving an upstream (downstream) offer. Let us now relax this condition and allow agents to form blocking cycles: now every agent can offer an upstream at a downstream contract simultaneously without having to accept them individually. This is a mild strengthening of trail stability (whenever there is at most one contract between agents) that treats the initial and the terminal agents in the blocking trail in the same way as the intermediate agents in the blocking trail and allows for minimal additional coordination among blocking agents.
For the sake of further simplicity, let us only focus on paths, i.e., trails in which all agents are distinct.
Definition 5.
A nonempty set of contracts () is a path if its elements can be arranged in some order such that

holds for all , and

all firms , and are distinct.
Now, a path that “returns” to its origin agent is a cycle.
Definition 6.
A nonempty set of contracts () is a cycle if its elements can be arranged in some order such that

holds for all ,

all firms , and are distinct, and

.
Cycles are therefore also trails.
Definition 7.
An outcome is pathorcyclestable if

is acceptable.

There is no path or cycle such that and is acceptable for each .
Such paths or cycles are called blocking paths and blocking cycles.^{9}^{9}9Note that pathorcycle stability is weaker than chain stability in the sense of Hatfield et al. (2015).
An interesting property of flowbased choice functions is that given an outcome , any cycle disjoint from is a blocking cycle, as any firm which is offered a pair of additional upstream and downstream contracts will accept them. We will use this property to prove our second key result.
Theorem 2.
It is complete to decide if a flow network admits a pathorcyclestable outcome.
Proof.
The problem is in , since given an outcome , we can check in linear time (with respect to the number of contracts) whether it admits a blocking path or a cycle: we only have to check that the contracts do not contain a cycle or a path starting with an (acceptable contract and ending with an (acceptable contract; both these tasks can be decided using, e.g., some variant of the depthfirst search (DFS) algorithm on the directed graph representing .
To prove hardness, we present a polynomial reduction from the following problem: given a directed graph , decide whether it is possible to partition the vertices of into two acyclic sets and . Here, a set of vertices is acyclic, if there is no directed cycle in . This problem was proved to be complete by Bokal et al. (2004).
Given our input , we construct a set of contracts and a set of firms with flowbased choice functions (see Fig. 1 for an illustration). There will be at most one upstream and at most one downstream contracts between any two firms, so we will denote a contract with and as . First, we introduce a node gadget for each ; the set of firms in is and the set of contracts in is . Next, we add terminal firms and , together with the contracts and for each . Finally, we add the contract set .
Instead of describing the full preferences of each firm over its upstream and downstream contracts, we only define a partial ordering (and assume that the preferences of each firm respect this partial order). Namely, for each , we let prefer to , and we let prefer to . In Fig. 1, we indicate the rankings of the contracts with numbers 1 (highest rank), 2 (second highest) etc. Additionally, we let any firm in prefer all contracts not in to contracts in .
We claim that there exists an outcome in admitting neither blocking paths nor blocking cycles if and only if the vertices of can be partitioned into two acyclic sets.
“”: Let us suppose that there exists an outcome that does not admit any blocking paths or cycles.
We show that . To see this, first consider a contract , and suppose for contradiction that . Since has only one downstream contract , this means that the contract cannot be contained in (because of the Kirchhoff equality for ). Note also that is acceptable, because it is a contract preferred by to . Consider the path from through to . Clearly, if neither contract on is in , then it is a blocking path, otherwise the contract is acceptable and hence a blocking path itself, a contradiction. So suppose now . Arguing analogously as before, we can prove that either the path from through to , or simply the contract is blocking. Thus we obtain that cannot contain any contracts from , and only contains contracts within node gadgets and contracts where the seller or the buyer is the terminal agent or the terminal agent , respectively.
Therefore, we know that for each , at most one of the contracts and can be contained in (since can choose at most one of its downstream contracts by the Kirchhoff equality). Let , and let ; clearly for any . It is not hard to see that both and are acyclic. Indeed, any cycle within vertices of in corresponds to a cycle using only contracts of and the contracts , , and such a cycle cannot exists as it would block . The same argument works to show the acyclicity of , proving the first direction of our reduction.
“”: Assume now that and are two acyclic subsets of forming a partition. We define an outcome that contains the contracts , , , , and for each , and similarly, the contracts , , , , and for each . We claim that there is no blocking path or cycle for .
To see this, observe that by the Kirchhoff equality a contract that is acceptable in itself for some firm (but is not contained in ) must be either for some or for some . Since there is no path starting with a contract and ending with a contract , we know that no path can block .
To show that admits no blocking cycles, we simply use that blocking cycles must be disjoint from . Note that any cycle has to use at least one contract of , as node gadgets are acyclic. We partition the contracts in into four sets as follows; recall that . Let denote those contracts in that leave a node gadget with and arrive at a node gadget with ; we define , , and analogously. To see that no contract can be part of a blocking cycle for , note that contains either the unique upstream contract of or the unique downstream contract of , by the definition of . In either case, any cycle that contains the contract must also contain a contract in , and hence cannot be a blocking cycle.
By the same reasoning, no contract for some can be contained in a blocking cycle, since both the unique upstream contract of and the unique downstream contract of are contained in . Therefore, any contract of used by a blocking cycle must be of the form for some . Similarly, any contract of used by a blocking cycle must be of the form for some . By the structure of the network, this implies that no cycle can use contracts both from and from . However, any blocking cycle that uses only contracts in and contracts of the form with directly corresponds to a cycle within . Similarly, any blocking cycle using only contracts in and contracts of the form with yields a cycle within . Therefore, the acyclicity of and ensures that admits no blocking cycle, proving the correctness of our reduction. ∎
If we translate Theorem 2 into the language of stable flows introduced by Fleiner (2014), we obtain that it is complete to decide whether a completely stable flow exists in a given network with preferences, where a flow is completely stable if it admits neither blocking paths nor blocking cycles. In fact, our statement holds not only in the discrete case (as implied directly by Theorem 2), but also in the continuous case where the flow can take real values as well; adjusting the proof of Theorem 2 to this case is straightforward. Hence we settle a conjecture posed by Fleiner (2014).
3.3 Stability
We now relax the assumption the blocking sets must be paths or cycles and consider general set blocks in trading networks (Hatfield et al., 2015) and flow networks (Fleiner, 2014).
Definition 8.
An outcome is stable if:

is acceptable.

There exist no nonempty set of contracts , such that and is acceptable for all ; such sets are called blocking.
Stable outcomes are immune to deviations by arbitrary groups of firms, which can recontract freely among themselves while keeping any of their existing contracts. Stable outcomes always exist in acyclic networks if choice functions are fully substitutable. However, Fleiner (2014) and Hatfield and Kominers (2012) showed that stable outcomes may not exist in general trading networks.
3.3.1 Stability in flow networks
We next prove that in flow networks pathorcyclestable outcomes coincide with stable outcomes.
Theorem 3.
In a flow network an outcome is pathorcyclestable if and only if it is stable.
Proof.
Let be a set of firms in a flow network. Using the definitions, it is immediate that a stable outcome is also pathorcyclestable, as a blocking path or cycle is naturally a blocking set as well.
For the opposite direction, assume that is a pathorcyclestable outcome. Towards contradiction, let us also assume that is a blocking set for . Suppose first that contains a cycle . Then is disjoint from because . Moreover, is acceptable for any firm : if is a terminal then it accepts all contracts offered, and if is nonterminal then, by the Kirchhoff equality, it accepts alongside with since is either empty or it contains an upstream and a downstream contract for . Hence, is a blocking cycle for . This proves that cannot contain any cycles. Let us now consider a path in that is maximal (in the sense that no contracts can be added to to obtain a longer path). By the acyclicity of , must be a firm with no upstream contracts in , and must be a firm with no downstream contracts in .
Since is blocking for , we know that is acceptable. Recall that has a flowbased choice function. Therefore either is a terminal firm (always accepting every offered contract), or must obey the Kirchhoff inequality, and therefore can accept the downstream contract only if there is a less preferred downstream contract in . Note that this means that the contract is acceptable. Using the fact that is acceptable, we can argue analogously to show that the contract is acceptable. Finally, consider any intermediary firm lying on path ; assume that for some . Again, either is terminal (and thus accepts all offers) or it is nonterminal and obeys the Kirchhoff equality. In the latter case, the path is acceptable because it contains exactly one upstream contract and one downstream contract for , namely and . Hence we get that is a blocking path for , a contradiction. ∎
Theorems 2 and 3 imply that deciding whether a stable outcome exists in a flow network is complete.
Corollary 1.
It is complete to decide if a flow network admits a stable outcome.
3.3.2 Stability in trading networks
We finally turn to the existence of stable outcomes in trading networks which was first considered by Hatfield et al. (2015). They showed that (under certain conditions) stable outcomes are equivalent to outcomes that are immune to blocks along trails in which every firm can simultaneously offer and accept all its contracts in the trail. However, it is easy to see that in general trading networks pathorcycle stability does not imply stability. But since flow networks are a special case of the trading networks that we consider in our general model (because flowbased choice functions are fully substitutable and satisfy IRC), Corollary 1 implies that deciding whether a stable outcome exists is hard also in our trading networks model.
Corollary 2.
Suppose that in a trading network choice functions satisfy full substitutability and IRC. Then it is hard to decide if the trading network admits a stable outcome.
In fact, dealing with stable outcomes is even trickier in trading networks. Our last result demonstrates that even verifying whether an outcome is stable is computationally intractable in general trading networks.^{10}^{10}10The proof of Theorem 2 shows that in flow networks verifying whether an outcome is stable can be done in time linear in the number of contracts.
Let Instability be the following decision problem. An instance of Instability is a trading network with set of contracts and a set of agents (with choice functions that satisfy full substitutability and IRC) and an outcome . The answer for an instance of Instability is YES if the particular outcome is not stable (that is, if there is a set of contracts that blocks ), otherwise the answer is NO.
Theorem 4.
The Instability problem is complete. Moreover, if choice functions are represented by oracles, then finding the right answer for an instance of Instability might require an exponential number of oracle calls.
Proof of Theorem 4.
The Instability problem clearly belongs to complexity class , as verifying that a given set of contracts is a blocking set for an outcome requires polynomial time.
To show that Instability is hard we reduce the complete Partition problem to Instability. An instance of the Partition problem is given by a tuple of positive integers such that holds. The answer to this problem is YES if and only if there is a subset of such that where . Given our instance of Partition, we define an instance of Instability as follows. First, construct a trading network with firms and and with contracts and such that and for . Next, define choice function with the help of by
It is straightforward to check that satisfies IRC, so let us check whether it is fully satisfiable as well. First, since always accepts all upstream contracts, both SSS and CSC clearly hold for as a buyer (that is, conditions 1(a) and 2(a) are satisfied in Definition 1). To check sameside substitutability as a seller for , let us consider a fixed set of upstream contracts offered for . Then either accepts all downstream contracts (in case is such that ) or it rejects every downstream contract (otherwise); in either case, the set of contracts rejected by as a seller satisfies SSS (that is, condition 1(b) in Definition 1). To check crossside complementarity as a seller for (condition 2(b) in Definition 1), note that if rejects the contract , then it must be the case that for the offered set of upstream contracts. But then will reject for any subset too, so CSC follows as well. Hence, is fully substitutable.
Next, define as follows:
One can readily check that also satisfies IRC. To see that it is also fully substitutable, first notice that never rejects any upstream contracts, so it satisfies both SSS and CSC with as a buyer. To check the requirements for SSS with taking the role of a seller, let us fix a set of upstream contracts. If , then rejects all downstream contracts. Otherwise (that is, if ), suppose that rejects some from a set of offered downstream contracts. This means that there exists an index such that . But then, for any superset of dowstream contracts offered to , the same condition will hold for some , and thus will again be rejected. This proves SSS with being a seller. To verify that is also crossside complementary with as a seller, it suffices to observe that any downstream contract rejected while is offered to will get rejected again when is offered to . Hence, we get that is fully substitutable.
So far, based on our instance of Partition, we have determined a trading network. To finish the construction of our Instability instance, we set an outcome . We have to show that the answer to our instance of the Partition problem is YES if and only if is not stable.
Assume now that the answer to our instance of Partition is YES, that is, for some . Define and . By the above definitions, and , hence blocks , so is not stable.
Assume now that is not stable. This means that there is a blocking set to and define , and . As is blocking, we have and . If then , so , and hence is not blocking. Otherwise, , and from we get that . Moreover, from we get that . Consequently , and the answer to the Partition problem is YES.
To prove the second part of the theorem, define a trading network with firms and and with contracts and such that and for for . Define the following choice function
(3.1) 
For define . For let
It is straightforward to check that choice functions and above satisfy the full substitutability condition and IRC. Define the following choice function for
(3.2) 
As for , also satisfies the full substitutability condition and IRC.
Now assume that an instance of Instability is given by the above network and an outcome . Assume that the choice functions are not given explicitly, but by valuereturning oracles. Moreover, we know exactly that the choice function of is the one defined in (3.2) and we know that the choice function of is either or for some . It is easy to check that is not stable if and only if and in this case the only blocking set is . So if one has to decide stability of , then one must determine the values for all such possible , and this means oracle calls. ∎
4 Open question
Fleiner, Jankó, Tamura, and Teytelboym (2016) introduce another solution concept, called weak trail stability. Let us consider a trail whose elements are arranged in a sequence and define to be firm ’s contracts out of the first contracts in the trail and to be firm ’s contracts out of the last contracts in the trail (where ).
Definition 9.
An outcome is weakly trailstable if

is acceptable.

There is no trail , such that and

is acceptable for and

At least one of the following two options holds:

is acceptable for whenever , or

is acceptable for whenever


is acceptable for .
The above trail is called a sequentially blocking trail to .

Like trail stability, weak trail stability also has an intuitive economic interpretation. But note that as the sequentially blocking trail grows, we ensure that each intermediate agent wants to choose all his contracts along the sequentially blocking trail. We did not impose this requirement for trail stability. As Fleiner, Jankó, Tamura, and Teytelboym (2016) argue weak trail stability might be a good solution concept in markets where contracts are not executed quickly. Fleiner, Jankó, Tamura, and Teytelboym (2016) also show that weak trail stability is a weaker solution concept than trail stability in trading networks under full substitutability (though not in general). However, unlike trailstable outcomes, the set of weakly trailstable outcomes does not appear to have a structure that allows for efficient computation.
Conjecture 1.
Suppose that in a trading network choice functions satisfy full substitutability and IRC. Then it is complete to decide whether there exists a weakly trailstable outcome that is not trailstable.
5 Conclusion
We showed that stable outcomes, which are immune to deviation by groups of agents and which can be efficiently computed in twosided matching markets or in supply chains, cannot be efficiently verified or computed in trading networks. Our main result is particularly strong: even in flow networks, outcomes that are immune to blocks in which even two agents can coordinate on an upstream and downstream contract cannot be computed efficiently. We suggest an alternative solution concept—trail stability—which, under full substitutability, always exists, has an intuitive economic interpretation, coincides with competitive equilibrium in model with prices, and can be efficiently found in general trading networks. Further work can examine the computation properties of similar stability notions in trading networks where agents have more complex preferences (Jagadeesan, 2017).
References
 Abdulkadiroğlu and Sönmez (2003) Abdulkadiroğlu, A. and T. Sönmez (2003). School choice: A mechanism design approach. American Economic Review 93(3), 729–747.
 Adachi (2017) Adachi, H. (2017). Stable matchings and fixed points in trading networks: A note. Economics Letters 156, 65–67.
 Alkan (2002) Alkan, A. (2002). A class of multipartner matching markets with a strong lattice struture. Economic Theory 19(4), 737–746.
 Aygün and Sönmez (2013) Aygün, O. and T. Sönmez (2013). Matching with contracts: Comment. American Economic Review 103(5), 2050–2051.
 Blair (1988) Blair, C. (1988). The lattice structure of the set of stable matchings with multiple partners. Mathematics of Operations Research 13(4), 619–628.
 Bokal et al. (2004) Bokal, D., G. Fijavz̆, M. Juvan, P. M. Kayll, and B. Mohar (2004). The circular chromatic number of a digraph. Journal of Graph Theory 46(3), 227–240.
 Delacrétaz (2019) Delacrétaz, D. (2019, January). Stability in matching markets with sizes.
 Delacrétaz et al. (2016) Delacrétaz, D., S. D. Kominers, and A. Teytelboym (2016). Refugee resettlement. Unpublished.
 Echenique (2007) Echenique, F. (2007). Counting combinatorial choice rules. Games and Economic Behavior 58(2), 231–245.
 Echenique and Oviedo (2006) Echenique, F. and J. Oviedo (2006). A theory of stability in manytomany matching markets. Theoretical Economics 1(1), 233–273.
 Fleiner (2003) Fleiner, T. (2003). A fixedpoint approach to stable matchings and some applications. Mathematics of Operations Research 28(1), 103–126.
 Fleiner (2014) Fleiner, T. (2014). On stable matchings and flows. Algorithms 7, 1–14.
 Fleiner et al. (2017) Fleiner, T., R. Jagadeesan, Z. Jankó, and A. Teytelboym (2017). Trading networks with frictions. Working paper, University of Oxford.
 Fleiner et al. (2016) Fleiner, T., Z. Jankó, A. Tamura, and A. Teytelboym (2016). Trading networks with bilateral contracts. Working paper, Oxford University.
 Fox (2017) Fox, J. T. (2017, May). Specifying a structural matching game of trading networks with transferable utility. American Economic Review 107(5), 256–60.
 Gale and Shapley (1962) Gale, D. and L. S. Shapley (1962). College admissions and the stability of marriage. American Mathematical Monthly 69(1), 9–15.
 Garey and Johnson (1979) Garey, M. and D. S. Johnson (1979). Computers and Intractability: A Guide to the Theory of NPCompleteness. W. H. Freeman and Company.
 Hatfield and Kominers (2012) Hatfield, J. W. and S. D. Kominers (2012). Matching in networks with bilateral contracts. American Economic Journal: Microeconomics 4(1), 176–208.
 Hatfield and Kominers (2014) Hatfield, J. W. and S. D. Kominers (2014, September). Hidden substitutes. Technical report, Mimeo.
 Hatfield et al. (2013) Hatfield, J. W., S. D. Kominers, A. Nichifor, M. Ostrovsky, and A. Westkamp (2013). Stability and competitive equilibrium in trading networks. Journal of Political Economy 121(5), 966–1005.
 Hatfield et al. (2015) Hatfield, J. W., S. D. Kominers, A. Nichifor, M. Ostrovsky, and A. Westkamp (2015, April). Chain stability in trading networks. Working paper, Mimeo.
 Jagadeesan (2017) Jagadeesan, R. (2017). Complementary inputs and the existence of stable outcomes in large trading networks. Harvard University Working Paper.
 Klaus and Walzl (2009) Klaus, B. and M. Walzl (2009). Stable manytomany matchings with contracts. Journal of Mathematical Economics 45(78), 422–434.

McDermid and
Manlove (2010)
McDermid, E. J. and D. F. Manlove (2010).
Keeping partners together: Algorithmic results for the
hospitals/residents problem with couples.
Journal of Combinatorial Optimization
19(3), 279–303.  Morstyn et al. (2018) Morstyn, T., A. Teytelboym, and M. D. McCulloch (2018). Bilateral contract networks for peertopeer energy trading. IEEE Transactions on Smart Grid.
 Ostrovsky (2008) Ostrovsky, M. (2008). Stability in supply chain networks. American Economic Review 98(3), 897–923.

Papadimitriou (2007)
Papadimitriou, C. H. (2007).
The Complexity of Finding Nash Equilibria.
In N. Nisan, T. Roughgarden, Éva Tardos, and V. V. Vazirani
(Eds.),
Algorithmic Game Theory
. Cambridge University Press.  Roth (1984) Roth, A. (1984). The evolution of the labor market for medical interns and residents: a case study in game theory. Journal of Political Economy 92(6), 991–1016.
 Sönmez and Switzer (2013) Sönmez, T. and T. Switzer (2013). Matching with (branchofchoice) contracts at the United States Military Academy. Econometrica 81(2), 451–488.
 Sotomayor (1999) Sotomayor, M. (1999). Three remarks on the manytomany stable matching problem. Mathematical Social Sciences 38, 55–70.
 Westkamp (2010) Westkamp, A. (2010). Market structure and matching with contracts. Journal of Economic Theory 145(5), 1724–1738.
Comments
There are no comments yet.