Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Dec 9th, 2004, 2:03 AM   #1
big_k105
PFO Founder

 
big_k105's Avatar
 
Join Date: Mar 2004
Location: Fargo, ND
Posts: 1,667
Rep Power: 10 big_k105 is on a distinguished road
Send a message via AIM to big_k105 Send a message via MSN to big_k105 Send a message via Yahoo to big_k105
Ok i have a question to ask. i have created a templated graph class and now i need to use the graph class in a map type program were the vertex's are cities and the wieghted edges are the roads with miles on them. and i am suppose to have the vertices as a class i created. kind of like say i call my graph class would be like this Graph<City> map(WEIGHTED); or something like that. i was wondering what kind of stuff am i goin to have to put in the City class. will it have to be a big class or will it only need a few small things. im just looking for an idea on what to do here. thanks
__________________
BIG K aka Kyle
Programming Forums
Kyle K Online

Please do not PM or email me programming questions. Post them in the forums instead.
big_k105 is online now   Reply With Quote
Old Dec 9th, 2004, 2:53 AM   #2
kurifu
Expert Programmer
 
kurifu's Avatar
 
Join Date: Jul 2004
Location: Halifax, Nova Scotia (Canada)
Posts: 784
Rep Power: 5 kurifu is on a distinguished road
Send a message via ICQ to kurifu Send a message via MSN to kurifu
Well first you are going to have to create CITY and export all variables and functions exactly as Graph is going to need them... I assume that Graph is a templated you created as well?

City will need a big matrix which will store the nodes (for both columns and rows) and the value that intersects will be the corresponding weighted link value representing a road. (There are other ways to represent a graph as well that are a bit more efficient than this, as in they consume less memory, you can look into using them yourself if you really wanted to).

Anyway, I think this is what you want... I am not entirely sure the relation between the Graph template and the City class, perhaps you could explain more what purpose each of these objects serve.
__________________
Clifford Matthew Roche &lt;geek@cliffordroche.com&gt;
Web Hosting: http://www.crd-hosting.com
Consulting: http://www.crdev-consulting.com
kurifu is offline   Reply With Quote
Old Dec 9th, 2004, 4:12 AM   #3
big_k105
PFO Founder

 
big_k105's Avatar
 
Join Date: Mar 2004
Location: Fargo, ND
Posts: 1,667
Rep Power: 10 big_k105 is on a distinguished road
Send a message via AIM to big_k105 Send a message via MSN to big_k105 Send a message via Yahoo to big_k105
The templated graph class is a fully working graph class but now i am suppose to do this
Quote:
The main.cpp that you electronically submit will contain a test program that you create. The program will be a map of cities/towns with the edges representing roads. Start by drawing a map on paper of the cities/towns and the roads (labeled with the distance) between them. You must turn this map in (or a copy) on the due date, even if you have not completed the program by this time. Follow these restrictions:

* use the templated graph class you created
* the graph is to be undirected and weighted (representing miles)
* vertices are a class that you create, for example
Graph<City> map(UNDIRECTED,WEIGHTED);
* there is a minimum of 10 cities/towns
* there is a minimum of 20 edges
* dump out the graph after it has been created
that is the exact second part of the assignment. and the part i dont get is the
Quote:
* vertices are a class that you create, for example
Graph<City> map(UNDIRECTED,WEIGHTED);
what am i suppose to put in the class and how would i even go about making it and what not. thanks I guess what im saying is i dont understand how a class can be a data type for a templated class.

if you want to see the code for the templated graph i will be posting it later
__________________
BIG K aka Kyle
Programming Forums
Kyle K Online

Please do not PM or email me programming questions. Post them in the forums instead.
big_k105 is online now   Reply With Quote
Old Dec 9th, 2004, 6:34 PM   #4
big_k105
PFO Founder

 
big_k105's Avatar
 
Join Date: Mar 2004
Location: Fargo, ND
Posts: 1,667
Rep Power: 10 big_k105 is on a distinguished road
Send a message via AIM to big_k105 Send a message via MSN to big_k105 Send a message via Yahoo to big_k105
does anyone understand what im trying to ask even. im curious if im asking the right question. well here goes another shot i guess. I have created a class called Graph. and it is templated so you would normally call it something like this
Graph<int> graph(WEIGHTED);
like that or so. and i have to create a City class i guess that will take the place of the int in that call like this
Graph<City> graph(WEIGHTED);
and this is where im confused. i do i even go about creating a class that is used as a data type? i dont understand it
__________________
BIG K aka Kyle
Programming Forums
Kyle K Online

Please do not PM or email me programming questions. Post them in the forums instead.
big_k105 is online now   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 4:54 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC