-3

specific question here. Suppose you have a graph where each vertice specifies how many connections they must have to another vertices and the following rules/properties apply:

1- The graph can be incomplete (no need to every vertice to have a connection with every other)

2- There can be two connections between two vertices only if they are in opposite directions (e.g: A points do B, B points to A).

3- Suppose they are on a 2D plane, there can be no crossing of connections (not even tangents).

4- Theres no interest for the shortest path, just respecting the properties and knowing if the solution is unique or not.

5- There can be no possible solution

EDIT: Alright guys sorry for not being specific. I'll try to clarify my point here: what I want to do is given a number of vertices, know if a graph is connected (if all the points have at least a connection to the graph). The vertices given can be impossible to make a graph of it so I want to know if there's is a solution, if the solution is unique or not or (worst case scenario) if there is no possible solution. I think that clarifies point 4 and 5. The graph is undirected, the connections can Not curve, only straight lines.The Nodes (vertices) are fixed, we have their position from or W/E input. I wanted to know the best approach and I've been researching and it is a connectivity problem, though maybe some specific alg may be more efficient doing this task. That's all, sorry for late reply

EDIT2: Alright guys would the problem be different if we think that each vertice is on a row and column of a plane matrix and they can only connect with other Vertices on the same column or row? So it would be just 90/180/270/360 straight connections. This would hugely shorten the possibilities right?

  • It's not clear what your question is. What problem is this algorithm supposed to solve? What do you mean by "match"? What are the input and output here? – user2357112 supports Monica Mar 29 '16 at 17:14
  • Basically what I'm wondering is what algorithm can make connections between the vertices following those properties and finding a solution – Francisco Azevedo Mar 29 '16 at 17:17
  • Okay, you want to generate a graph. I still don't understand what you're asking though, particularly in points 2, 4 and 5. – beaker Mar 29 '16 at 17:19
  • You are going to need to add some examples or more details to explain what you are trying to do, and even after clarification you will need to narrow down the scope of the question because general "What algorithm do I need" questions tend to be too broad and open-ended – Kevin Mar 29 '16 at 18:04
  • Do edges need to be straight, or can they curve? – Edward Peters Mar 29 '16 at 18:35
  • @beaker As I understand it: Point 2 - it is a directed graph and vertices can be connected in either one or both directions but there cannot be multi-edges in the same direction. Point 4 - I think it is just stating that the OP is looking to generate a graph and that they are not looking at a path through the graph but this point appears to be irrelevant to the question. Point 5 - ok, you got me, I have no idea what this point is about. – MT0 Mar 30 '16 at 00:25
  • @MT0 Okay, I see what you mean about Point 2; that make sense. The part that throws me about Point 4 is "knowing if the solution is unique or not". – beaker Mar 30 '16 at 00:33
  • @beaker I'm assuming that the OP wants to know if there are multiple graphs that will fulfil all the criteria or if there is one unique graph (or no graphs - which I'm now assuming is what point 5 is about). I've added a naive solution based on my assumptions on what the question means but would be interested in more optimal solutions. – MT0 Mar 30 '16 at 00:54
  • @EdwardPeters Any planar graph can be drawn with straight edges and if you can draw them with straight edges then they can also be drawn with curved edges. – MT0 Mar 30 '16 at 01:00
  • @MT0 Yeah, I misread the question - I thought the nodes were given fixed coordinates, for some reason. (Which would also be an interesting problem, and maybe more solveable.) – Edward Peters Mar 30 '16 at 07:34
  • Alright I've edited guys. Please continue the discussion I've liked to learn about your answers a lot – Francisco Azevedo Mar 31 '16 at 09:53

2 Answers2

0

I am going to assume that the question is: Given the degree of each vertex, work out a graph that passes all the constraints given.

I think you can reduce this to a very large integer programming problem - linear constraints, but with the variables required to be integers (in fact either 0 or 1), which makes the problem much more difficult than ordinary linear programming.

Let the unknowns be of the form Xij, where Xij is 1 if there is an edge from node i to node j, and 0 otherwise. The requirements on the number of connections then amount to requirements of the form SUM_{all i}Xij = K for some K dependent on the requirement. The requirement that the graph is planar reduces to the requirement that the graph not contain two known graphs as subgraphs - https://en.wikipedia.org/wiki/Graph_minor. Each possible subgraph then produces a constraint such as X01 + X02 + ... < 5 - there will be a huge number of these constraints - so large that for large number of nodes simply producing all the constraints may be too expensive to be practical, let alone solving them. The number of constraints goes up as at least the 6th power of the number of nodes. However this is polynomial, so theoretically practical to write down the MIP to be solved - so perhaps this is better than no algorithm at all.

mcdowella
  • 18,736
  • 2
  • 17
  • 24
0

Assuming that you are asking us to:

Find out if it is possible to generate one-or-more directed planar graphs such that each vertex has a given out-degree (not necessarily the same out-degree per vertex).

Let's also assume that you want the graph to be connected.

If there are n vertices and the vertices have degrees d_1 ... d_n then for vertex i there are C(n-1,d_i) = (n-1)!/((d_i)!*(n-1-d_i)!) possible combinations of out-edges from that vertex. Taking the product of all these combinations over all the vertices will give you the upper bound on the number of possible graphs.

The naive approach is:

  • Generate all possible graphs.
  • Filter the graphs to only have connected graphs.
  • Run a planarity test on the graph to determine if it is planar (you can consider the graph to be undirected in this step); discard if it isn't.
  • Profit!
MT0
  • 86,097
  • 7
  • 42
  • 90
  • That is an interesting approach but I wanted to generate a graph that would be already connected or just admit It cant be feasible. Although I think my approach is kinda naive since we generally generate graphs and then apply a search algorithm to know if it follows our specifications right? EDIT: Wow that thesis is gigantic, so many algorithms and theorems. Smart people! – Francisco Azevedo Mar 31 '16 at 09:44