-
Hardness of Finding Kings and Strong Kings
Authors:
Ziad Ismaili Alaoui,
Nikhil S. Mande
Abstract:
A king in a directed graph is a vertex $v$ such that every other vertex is reachable from $v$ via a path of length at most $2$. It is well known that every tournament (a complete graph where each edge has a direction) has at least one king. Our contributions in this work are:
- We show that the query complexity of determining existence of a king in arbitrary $n$-vertex digraphs is $Θ(n^2)$. This…
▽ More
A king in a directed graph is a vertex $v$ such that every other vertex is reachable from $v$ via a path of length at most $2$. It is well known that every tournament (a complete graph where each edge has a direction) has at least one king. Our contributions in this work are:
- We show that the query complexity of determining existence of a king in arbitrary $n$-vertex digraphs is $Θ(n^2)$. This is in stark contrast to the case where the input is a tournament, where Shen, Sheng, and Wu [SICOMP'03] showed that a king can be found in $O(n^{3/2})$ queries.
- In an attempt to increase the "fairness" in the definition of tournament winners, Ho and Chang [IPL'03] defined a strong king to be a king $k$ such that, for every $v$ that dominates $k$, the number of length-$2$ paths from $k$ to $v$ is strictly larger than the number of length-$2$ paths from $v$ to $k$. We show that the query complexity of finding a strong king in a tournament is $Θ(n^2)$. This answers a question of Biswas, Jayapaul, Raman, and Satti [DAM'22] in the negative.
A key component in our proofs is the design of specific tournaments where every vertex is a king, and analyzing certain properties of these tournaments. We feel these constructions and properties are independently interesting and may lead to more interesting results about tournament solutions.
△ Less
Submitted 27 April, 2025;
originally announced April 2025.
-
Linear-Time Graph Programs without Preconditions
Authors:
Ziad Ismaili Alaoui,
Detlef Plump
Abstract:
We report on a recent breakthrough in rule-based graph programming, which allows us to reach the time complexity of imperative linear-time algorithms. In general, achieving the complexity of graph algorithms in conventional languages using graph transformation rules is challenging due to the cost of graph matching. Previous work demonstrated that with rooted rules, certain algorithms can be execut…
▽ More
We report on a recent breakthrough in rule-based graph programming, which allows us to reach the time complexity of imperative linear-time algorithms. In general, achieving the complexity of graph algorithms in conventional languages using graph transformation rules is challenging due to the cost of graph matching. Previous work demonstrated that with rooted rules, certain algorithms can be executed in linear time using the graph programming language GP 2. However, for non-destructive algorithms that retain the structure of input graphs, achieving linear runtime required input graphs to be connected and of bounded node degree. In this paper, we overcome these preconditions by enhancing the graph data structure generated by the GP 2 compiler and exploiting the new structure in programs. We present three case studies, a cycle detection program, a program for numbering the connected components of a graph, and a breadth-first search program. Each of these programs runs in linear time on both connected and disconnected input graphs with arbitrary node degrees. We give empirical evidence for the linear time complexity by using timings for various classes of input graphs.
△ Less
Submitted 26 March, 2025;
originally announced March 2025.
-
Rule-Based Graph Programs Matching the Time Complexity of Imperative Algorithms
Authors:
Ziad Ismaili Alaoui,
Detlef Plump
Abstract:
We report on a recent breakthrough in rule-based graph programming, which allows us to match the time complexity of some fundamental imperative graph algorithms. In general, achieving the complexity of graph algorithms in conventional languages using graph transformation rules is challenging due to the cost of graph matching. Previous work demonstrated that with rooted rules, certain algorithms ca…
▽ More
We report on a recent breakthrough in rule-based graph programming, which allows us to match the time complexity of some fundamental imperative graph algorithms. In general, achieving the complexity of graph algorithms in conventional languages using graph transformation rules is challenging due to the cost of graph matching. Previous work demonstrated that with rooted rules, certain algorithms can be implemented in the graph programming language GP 2 such that their runtime matches the time complexity of imperative implementations. However, this required input graphs to have a bounded node degree and (for some algorithms) to be connected. In this paper, we overcome these limitations by enhancing the graph data structure generated by the GP 2 compiler and exploiting the new structure in programs. We present three case studies: the first program checks whether input graphs are connected, the second program checks whether input graphs are acyclic, and the third program solves the single-source shortest-paths problem for graphs with integer edge-weights. The first two programs run in linear time on (possibly disconnected) input graphs with arbitrary node degrees. The third program runs in time O(nm) on arbitrary input graphs, matching the time complexity of imperative implementations of the Bellman-Ford algorithm. For each program, we formally prove its correctness and time complexity, and provide runtime experiments on various graph classes.
△ Less
Submitted 15 January, 2025;
originally announced January 2025.