C Board  

Go Back   C Board > General Programming Boards > C Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 12-26-2001, 04:48 AM   #1
....
 
Join Date: Aug 2001
Location: Groningen (NL)
Posts: 2,386
Minimize crossing edges in undirected graph

I have an undirected graph with N vertices. Each vertex can be on more than one edge. So when I draw this graph on my 2D screen, it can happen that edges will be crossing each other.

It is impossible to avoid crossing edges, but I guess there is some algorithm which is able to minimize the number of crossing edges. Can anyone help me?

Perhaps an "easier" question is: how can I determine whether two edges will be crossing? In graphs coordinates are not used, so there must be a different way than geometric to determine this.

For your information, the graph is implemented as a table:

struct graph
{
int nr_of_vertices;
bool adjacency_table [MAX_VERTICES][MAX_VERTICES];
}

So assume a graph has 4 vertices and the following relations exist (1,2), (1,4) and (2,3). Then the table would look like this:

1 2 3 4
1 T T F T
2 T T T F
3 F T T F
4 T F F T
Shiro is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Undirected graph and Binary Tree problem arafat21 C Programming 3 05-02-2008 05:52 AM
error help making no sense tunerfreak C++ Programming 5 04-17-2007 07:55 PM
How to use C++ graphs? eur0dad C++ Programming 4 10-14-2006 11:37 AM
Help w/ graph as adjacency matrix ac251404 C++ Programming 4 05-09-2006 10:25 PM


All times are GMT -6. The time now is 11:02 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22