473,320 Members | 1,947 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Help: Algorithms in C (Sedgewick) "Graph.h"

Hey all,

In an effort to solve a sticky - for me - problem I've picked up
Sedgewick's 'Algorithm's in C'. I've tried working through the first
few problems but am a little stumped when he refers to #include
"Graph.h" in the header file of the first program.

The style he uses to make his declarations is a little unfamiliar to
me, but here is my best guess at a "Graph.h" header file:

#ifndef FILE_H
#define FILE_H

typedef struct { int v; int w; } Edge;

Edge EDGE( int, int);

typedef struct graph *Graph;
Graph GRAPHinit(int);
void GRAPHinsertE(Graph, Edge );
void GRAPHremoveE(Graph, Edge );
int GRAPHedges( Edge[], Graph G );
Graph GRAPHcopy(Graph);
void GRAPHdestroy(Graph);

Graph GRAPHrand( int V, int E );

void GRAPHshow( Graph G );

void dfsRcc( Graph G, int v, int id );

int GRAPHcc(Graph G);

#endif

And here is main:

main (int argc, char * argv[] ) {
int V = atoi( argv[1] ), E = atoi( argv[2] );
Graph G = GRAPHrand(V,E);

if ( V < 20 )
GRAPHshow(G);
else printf("%d vertices, %d edges, ", V, E );
printf( "%d component(s)\n", GRAPHcc(G));

}
Judging by main I would call "Graph.h" but it looks like its been
sorta done already...

typdef struct Graph {
int E; /*Edges*/
int G; /*Verticies/
}

Any help would be much appreciated...

Thanks,
entropy
Nov 13 '05 #1
1 4353
entropy123 wrote:
Judging by main I would call "Graph.h" but it looks like its been
sorta done already...
What do you mean by "call Graph.h"?
typdef struct Graph {
int E; /*Edges*/
int G; /*Verticies/
}
What does definition of the Graph structure have to do with anything?
Any help would be much appreciated...


What exactly is the problem?

--
Martijn Haak
http://www.serenceconcepts.nl
Nov 13 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: newbie_mw | last post by:
Hi, I need urgent help with a novice problem. I would appreciate any advice, suggestions... Thanks a lot in advance! Here it is: I created a sign-up sheet (reg.html) where people fill in their...
0
by: newbie_mw | last post by:
Hi Ian, Thanks for help! The columns and variables are exactly matched so it shouldn't be the problem. Actually the original html and php files are pretty long. But I guess a more detailed...
0
by: python-help-bounces | last post by:
Your message for python-help@python.org, the Python programming language assistance line, has been received and is being delivered. This automated response is sent to those of you new to...
7
by: tcarvin | last post by:
The .NET studio help system seems to use these odd URLs to locate (html) help files to display. But on my system, I get "Server not found" web errors whenever I access Help. What do I have to do...
23
by: Rogers | last post by:
I want to compare strings of numbers that have a circular boundary condition. This means that the string is arranged in a loop without an end-of-string. The comparaison of two strings now...
1
by: Cristian | last post by:
Hello. I would make some graph about some data from my SQL Server DB. Do you know some methods?? Please help me and sorry for my english!! Bye Cris
2
by: Devlei | last post by:
I have added a HelpProvider to my Form, and set the HelpNavigator and HelpKeyword in the Form's properties. When my Form opens and I press F1, the Help activates correctly, but nothing occurs...
4
by: welwel007 | last post by:
I have to learn about the algorithms :" devide and comquer " in the book " problems on algoritms" , but I'm not good at English, please give me some guides about it. I need some easy exercises. My...
1
by: iniyan | last post by:
i want to display data into graph and chart using asp but not sure how to do it.i want to retrieve the data from mysql.
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.