UNIX Socket FAQ

A forum for questions and answers about network programming on Linux and all other Unix-like systems

You are not logged in.

#1 2007-12-19 06:04 PM

eleanor
Member
Registered: 2007-11-11
Posts: 23

Re: digraph ADT

Hey, I'm wondering how to implement a class for directed graph in c++.
I have a *.txt file with points in coordinating system specified like this
1 2 3 4
4 9 1 0
1 4 18 54

--> an a direction if between: (1,2) -----> (3,4) etc...

I choose to use: Adjacency List Representation. So any ideas how to implement this. Maybe like this:

class CDiGraph : public QWidget {
public:
	CDiGraph();
	
private:
	int startingPoints[][];
	int endingPoints[][];
};

--> I have an 2 dmensional array for starting points (1,2) and 2 dimensional array for ending points (3,4) . And connections are between the same i,j indexes?

And ideas how to optimize my solution?

Offline

#2 2007-12-20 10:59 PM

mlampkin
Administrator
From: Sol 3
Registered: 2002-06-12
Posts: 911
Website

Re: digraph ADT


"The only difference between me and a madman is that I'm not mad."

Salvador Dali (1904-1989)

Offline

Board footer

Powered by FluxBB