co.combinatorics - What is simplest polynomial algorithm for PLANARITY?

There are several algorithms that decide in polynomial time whether a graph can be drawn in the plane or not, even many with a linear running time. However, I could not find a very simple algorithm that one could easily and fast explain in class and would show that PLANARITY is in P. Do you know any?If necessary, you can use Kuratowski's or Fary's theorem but no deep stuff, like the graph minor theorem.Also note that I do not care about the running time, I just want something polynomial. Below are the so far 3 best algorithms, showing a simplic...Read more

graph algorithms - Data Strcuture to represent dependencies amongst modules

Consider several software modules $m_1, m_2, ... m_n$. Each module has some inputs and outputs and the inputs to some of the modules are dependent on the outputs of some other modes. For example, in the figure, module $m_3$ and $m_4$ are dependent on the output of module $m_1$. If we are given a set if inputs $I$ and a set of outputs $O$, the objective is to find a set of modules which produce this output.For example, if the output set $O$ is $\{o_1, o_2\}$ then all of the modules would have to be used. However if the output set $O$ is $\{o_2\}...Read more

ds.data structures - Efficient algorithms for searching a collection of trees

I have a large dataset of trees and I would like to search it by specifying a treelet (connected subgraph). The query should return all the occourrences of the treelet in the dataset.Are there efficient algorithms to do so?I was thinking of something like suffix arrays, however, naively encoding the trees as strings (by a fixed traversal ordering of their nodes) won't work, since the search treelet can be of any arbitrary shape. UPDATE:Some details about the typical instances I expect:The dataset will consist in at least tens of thousands trees...Read more

I found an algorithm for computing multiple MSTs in O(E/V). Is this publishable?

Let's say you use Kruskal's or Prim's algorithm to compute the first MST, and you want to check to see if there are other MSTs. I can do this in O(E/V) time. The algorithm uses a priority queue (which can be constructed in O(N) ). Kruskal's and Prim's already use priority queues, but they're slower than the linear time algorithms listed below. I know there are already algorithms that can find a single MST in linear time: A randomized algorithm can solve it in linear expected time. [Karger, Klein, and Tarjan, "A randomized linear-time algorithm ...Read more

np hardness - Exact Algorithms for r-Dominating Set on Bounded Treewidth Graphs

Given a graph, $G = (V, E)$, I want to find an optimal $r$-domination for $G$. That is, I want a subset $S$ of $V$ such that all vertices in $G$ are at a distance of at most $r$ from some vertex in $S$, while minimizing the size of $S$. From what I have checked so far, I got the following: There is this related problem of finding a $(k,r)$-center in a graph which is a subset $S$ of size at most $k$ such that all the vertices in the graph are at a distance of atmost $r$ from some vertex in $S$(here both $|S| \leq k$ and $r$ are parts of the inpu...Read more

complexity of graph 2.5-coloring

My question is inspired by this one. ​ I define 2.5-coloring to be the parameterized problemInstance: an integer j and an n-vertex non-empty simple graph GParameter: integer kOutput: if there is a 3-coloring of G in which at least one ofthe colors is used at most ​ min($\hspace{.03 in}$j,k) ​ times then YES else NO.Since j is part of the input and the only involvement of k is via ​ min($\hspace{.03 in}$j,k) , ​ increasing kcannot make 2.5-coloring easier. ​ ​ ​ ​ Even for k=0, that problem is logspace-complete.For k in nΩ(1), that problem is N...Read more

graph algorithms - Hardness of 3-dimensional matching variant

I am thinking about a variant of 3-dimensional matching. In normal 3d matching, we have three sets of vertices $X$, $Y$ and $Z$, and a set of edges $E \subseteq X \times Y \times Z$. We want to choose a matching $M \subseteq E$ of maximum size. I would like to instead choose $M$ from the set $E \cup \{(x,w) \bigm| \exists z: (x,w,z) \in E \vee \exists y: (x,y,w) \in E\}$. So for each triple in $E$, assume that choosing a pair with the first and second elements or a pair with the first and third elements to be part of $M$ would also be acceptabl...Read more

How to design an algorithm which turns an undirected graph into directed with all nodes of indegree higher than 0?

Given an undirected graph $G=(V,E)$ devise an algorithm that will check whether its edges can be directed in such a way that the vertices of the resulting directed graph will all have indegree higher than $0$. For any edge $\{u,v\}∈E$ only one direction can be chosen: $(u,v)$ or $(v,u)$.I'm quite new to graphs and graph algorithms so I was wondering if I'm on the right track:I think the key to the solution is to determine whether the graph is acyclic. In order to do that we can use BFS algorithm on the graph by coloring layer $i$ in red, layer ...Read more

treewidth - Long Cycle in Bounded Tree-Width Graphs using DFS and Dynamic Programming

For fixed parameter $k$, I would like to find a long cycle of length $\geq k$ in an undirected graph $G(V,E)$. This can be done in $O(k!2^k|V|)$-time [2] using 1) depth-first search (DFS) and 2) dynamic programming on a bounded tree-width decomposition of $G$ derived from the DFS traversal. However, [2] does not contain explicit details on what information should be stored in the tables associated with each bag of the tree decomposition. When looking for long cycles using the dynamic programming method suggested by [2], are there any ideas...Read more

Color shifting in a bipartite graph

Assume that we have a directed bipartite graph $G = \langle L\dot\cup R, E\rangle $. Where $E$ contains directed edges only from $L$ to $R$, that is, $E\subseteq L\times R$. Assume further that the degree of each vertex is at most $k$. Now consider the problem of coloring $G$'s edges with $k$ colors, such that no adjacent edges have the same color. This problem can be solved efficiently by noting that $G$ is a subgraph of a $k$-regular bipartite graph and thus one can compute a perfect matchings to color $G$.The problem I'm trying to solve is a...Read more

optimization - Fast algorithm for weighted bipartite matching problem

I have a set of $n$ agents and a set of $n$ tasks, and I need to assign each agent to exactly one task such that a cost is minimised. Some agents are incompatible with some tasks.I have an implementation of the Hungarian Algorithm which takes about a minute to solve for my $640 \times 640$ matrix. For forbidden assignments, I set the cost to $\infty$. (There always exists a feasible solution in my problem).I've also set it up as a binary program in CPLEX, which takes about 9 seconds to solve for the same problem. The BIP model excludes forbidde...Read more

graph algorithms - Shortest simple path with minimum edge cost minus node reward

I have a directed graph which has cycles. Each edge has a nonnegative weight and each vertex has a nonnegative reward.Given two vertices s and t, I need to find a simple path (a path with no repeated vertices) from s to t which minimizes (sum of edge weights on the path) - (sum of vertex rewards covered by the path). One can surely absorb node reward into edge weight like this post, but then the edge weight can become negative and negative cycles can emerge. As a result, the shortest simple path, if posed in such a general setting, is NP-hard ...Read more

graph algorithms - DAG reachability with O(n log n) space and O(log n)-time queries?

For a directed acyclic graph ${\langle}V,E{\rangle}$, is there a data structure that allows for reachability queries without requiring quadratic space or linear time? Ideally I seek an algorithm using only O(log n) space per vertex and logarithmic time where $n=|V|+|E|$.It seemed intuitively obvious to me that a data structure like this ought to exist, based on some generalization of standard sorting algorithms. But I was surprised that I couldn't find any. Everything I came across either made assumptions about the graph (e.g. planarity) or ...Read more