Maximizing Subgraph "value" given budget - algorithm

The scenario at hand that I would like to solve is a maximization problem where each vertex in the connected un-directed graph has a value. However, each edge and vertex also has a cost.
Given a starting vertex and a cost budget, is there a recommended algorithm or approach to find the connected subgraph which maximizes the vertex value
(including the starting vertex) ?

This is NP-hard because you could use an algorithm for this to solve the Steiner tree problem in graphs by setting the value for each terminal to be 1, the cost for each vertex to be 0, and the cost for each edge to be 1. There is a Steiner tree with weight k if and only if your algorithm with a cost budget of k is able to capture the value from all the terminals.
It may help to investigate the literature for Steiner trees to get some ideas for approximate solution ideas.

Related

Subgraph with minimum edge weight and node weight >= Val

I came across this problem - In an undirected graph every node and edge has a weight. All the weights are non-negative. Given a value S, Find the connected subgraph with minimum sum of edge weights such that its sum of node weights is at least S.
The most obvious solution is a brute force approach considering all possible subgraphs. But the time complexity is exponential. Is there any better algorithm for this? My intuition is that we can convert node weights to edge weights and then apply spanning tree algorithm. But I couldn't solve it clearly. How to solve this problem?
EDIT : Looks like I was not clear enough about the description of subgraph. The selected subgraph must be a single, connected component. I hope it's clear now.
I think this problem is NP-hard via a reduction from the Steiner tree problem. Given a graph G and a set of nodes S that need to be spanned, set the weight of all of the nodes in S to one and all the other nodes to 0. A subgraph with node weight at least |S| with minimum total edge cost must be a tree (if there are any cycles, deleting an edge from the cycle only decreases the cost) and must connect all of the nodes that need to be spanned. It's therefore a Steiner tree. Overall, this reduction can be computed in polynomial time, so your problem is NP-hard.

Non-directed graph algorithm to find lowest cost path

I know a few algorithms that are able to find the lowest cost path for directed graph (just as Dijkstra and Floyd).
Is there any algorithm that works for non-directed graphs?
My problem is: I need to find the lowest cost path from a to b passing through all vertexes (undirected graph).
My problem is: I need to find the lowest cost path from a to b passing
through all vertexes (non-oriented graph)
This is the Traveling Salesman Problem, which is NP-Hard, so there is no known efficient solution to it.
However, if the graph is fairly small, there are some techniques to solve it optimally (in exponential time), like Dynamic Programming.
In general, changing an undirected graph to a directed one is fairly easy and is done by changing an undirected edge {u,v} to two directed edges (u,v) and (v,u)
Provided you have nonnegative edge values, you could consider every edge in an undirected graph as two edges in a directed graph, one pointed to and from connected vertices. Then you could use one of many algorithms including the ones you listed.

Finding spanning tree with maximum minimum degree

Given a connected undirected graph, the problem of finding the spanning tree with the minimum max degree has been well-studied (M. F¨urer, B. Raghvachari, "Approximating the minimum degree spanning tree to within one from the optimal degree", ACM-SIAM Symposium on Discrete Algorithms (SODA), 1992). The problem is NP-hard and an approximation algorithm has been described in the reference.
I am interested in the following problem - given a connected undirected graph G = (V1,V2,E), find the spanning tree with the maximum min degree over all internal nodes (non-leaf nodes). Can someone please tell me if this problem has been studied; is it NP-hard or does there exist a polynomial-time algorithm for solving it? Also, the graph can be considered to be bipartite for convenience.
As noted in Evgeny Kluev's comment, the leaves of a (finite) tree have degree 1. (Else, cycles would exist and the structure would not be a tree.)
If instead you mean to find a spanning tree with a node of maximum degree, from among all possible spanning trees on a connected undirected graph G, then just form a spanning tree whose root R is a node M of G with maximal degree among all the nodes of G, and all neighbors of M are children of R.
It looks like exact cover by 3-sets can be reduced to this problem. Represent the 3-sets by vertices of degree 4, each with 3 edges connecting it to 3 nodes representing its elements in the original problem instance. The additional 4th edge connects all the "3-set" nodes to a single vertex V.
This graph is biparite - every edge is between a "3-set" node and an "element" node (or V). Now this graph has a spanning tree of max min degree = 4 if and only if the original problem has a solution.
Obviously there need to be enough of the 3-sets so that the node V doesn't lower the max min degree of the tree, but this limit doesn't change the NP-hardness of the problem.

Maximum weight connected subgraph in an directed acyclic graph

I am working on a research problem involving logic circuits (which can be represented as DAGs). Each node in the DAG has a given weight, which can be negative. My objective is to find a connected subgraph such that the sum of the node weights is maximal.
The maximum weight connected subgraph problem given edge weights is NP-hard apparently, but what I am hoping is that the directed-acyclic nature and the fact that I am dealing with node weights rather than edge weights makes the problem somewhat easier. Can someone point me in the right direction of how to start attacking this problem?
Thanks
the problem you mentioned is NP-hard, see:
“Discovering regulatory and signaling circuits in molecular interaction networks”
by Trey Ideker, Owen Ozier, Benno Schwikowski, and Andrew F. Siegel,
Bioinformatics, Vol 18, p.233-240, 2002
and the supplementary information to this paper:
http://prosecco.ucsd.edu/ISMB2002/nph.pdf
First approach, Assign to each edge the inverse of the weight of the starting node, and apply a shortest path algorithm like Bellman-Ford. The Dijkstra's algorithm won't work as some edges can be negative.
Second approach, starting on each leaf node, add "tags" to each edge that keeps track of the ids of all the nodes involved, and the total weight. There is no need to mark the node, as each node is guaranteed to be visited only once for each chain starting on the leafs. For example, given the following Acyclic Directed graph (directed top to bottom) where each node weights 1:
A G
/ \ /
/ \ /
B C
| / \
D E F
\ /
H
The edge between A and B will be tagged {{D,B,A},3}, the edge between A and C will have two tags {{H,E,C,A},4} and {{H,F,C,A},4}.
After this pre-procesing, find the greatest weight path for each root node. The information is in the tags of their outbound edges.
You mentioned that connected that connected subgraph should be "maximal". For this greedily choose a vertex and grow it until you cannot grow. this assures maximality. However if you mean "maximum" then the problem might be NP_Complete. Also let me remind you that node weighted graphs are more general than edge weighted graphs. Every algorithm built for the former is applicable to later but vice-versa is not always true. This is very easy to see. Try out yourself.
What i understand the problem, i feel it is in P. If that is correct then the Hint for that is to use some special property for DAGs (which u shud know since u r researching and this seems a lecture notes problem). For general graphs, this is reducible to steiner trees so it is NP-Cmplete(infact also for planar graphs).
I think your problem is NP hard if the maximum weight connected subgraph problem given edge weights is NP hard. You can reduce the node weight problem to the edge weight problem.
1)Lets say that your nodes have weights wn1,wn2,wn3,....wnN; where N is # of nodes.
2)Lets also say that the edges can be represented by e1,e2,e3,...eE; E- # of edges.
The weight of the edge ei:nj->nk can be defined as F(wnj,wnk), the function being
arbitrary. For simplicity we can assume wei=wnj+wnk.
Now if we assume that all node weights are independent and non-identical, then we
can say the same about the edge weights. As a DAG with non-identical edge weights
is NP hard, your problem too is.
Having said that, I think you should proceed in the following way:
1)Look for similarity in node weights for your particular problem. If there are any,
try to look up the literature for similar problems.
2)If they are hard to find, I suggest you translate your node weight problem to edge
weight one, and see how the similarity in node weights translates to edge weights
problem and see what simplification can you apply to this problem, again from
literature.
I hope this helps.

How to efficiently construct a connected graph?

For fun I'm learning about graph theory and I came across this problem. Given a set of vertices V, a set of edges E, and a weight for each edge in E, how can I efficiently construct a graph G such that:
G is connected (all vertices are connected via some path)
the sum of the weights of the edges is minimized
The edges in E are directed, when all edges in E are present there can be cycles.
See Minimum Spanning Tree algorithms.
ok... can i know what MrDatabase is after? SSSP algorithms (dijkstra, Bellman-Ford) are variation of MST, which ars just mentioned. Dijkstra does not solve negative weight cycle issue while Bellman-Ford does.
To add to ars's answer, if your graph contains edges with negative weight, then the problem becomes more difficult (and there may be no solution if you have a negative-weight cycle).
Read Bellman-Ford Algorithm. It supports negative weight cycles. Dijkstra's algorithm is more efficient but it doesn't support negative weight cycles.

Resources