closed account (*9EvM4iN6*)

hey guys im very new to programming and i have this program which i do not understand at all. i would appreciate if some1 could help me with it. I have the skeleton code but i do not know what to do. its regarding minimum spanning tree.

class Weighted_graph {

private:

static const double INF;

// your choice

public:

Weighted_graph( int = 50 );

~Weighted_graph();

int degree( int ) const;//Returns the degree of the vertex n. Throw an illegal argument exception if the argument does not correspond to an existing vertex.

int edge_count() const;//Returns the number of edges in the graph.

double adjacent( int, int ) const;//Returns the weight of the edge connecting vertices m and n. If the vertices are equal, return 0. If the vertices are not adjacent, return infinity. Throw an illegal argument exception if the arguments do not correspond to existing vertices.

double minimum_spanning_tree( int ) const;//Return the size of the minimum spanning tree of those nodes which are connected to vertex m. Throw an illegal argument exception if the arguments do not correspond to existing vertices.

bool is_connected() const;//Determine if the graph is connected.

void insert( int, int, double );//If the weight w < 0 or w = ∞, throw an illegal argument exception. If the weight w is 0, remove any edge between m and n (if any). Otherwise, add an edge between vertices m and n with weight w. If an edge already exists, replace the weight of the edge with the new weight. If the vertices do not exist or are equal, throw an illegal argument exception.

// Friends

friend std::ostream &operator << ( std::ostream &, Weighted_graph const & );

};

const double Weighted_graph::INF = std::numeric_limits<double>::infinity();

// Enter definitions for all public functions here

std::ostream &operator << ( std::ostream &out, Weighted_graph const &graph ) {

// Your implementation

return out;

}

#endif

its a really long message i know but i would really appreciate if some1 could help with the coding

class Weighted_graph {

private:

static const double INF;

// your choice

public:

Weighted_graph( int = 50 );

~Weighted_graph();

int degree( int ) const;//Returns the degree of the vertex n. Throw an illegal argument exception if the argument does not correspond to an existing vertex.

int edge_count() const;//Returns the number of edges in the graph.

double adjacent( int, int ) const;//Returns the weight of the edge connecting vertices m and n. If the vertices are equal, return 0. If the vertices are not adjacent, return infinity. Throw an illegal argument exception if the arguments do not correspond to existing vertices.

double minimum_spanning_tree( int ) const;//Return the size of the minimum spanning tree of those nodes which are connected to vertex m. Throw an illegal argument exception if the arguments do not correspond to existing vertices.

bool is_connected() const;//Determine if the graph is connected.

void insert( int, int, double );//If the weight w < 0 or w = ∞, throw an illegal argument exception. If the weight w is 0, remove any edge between m and n (if any). Otherwise, add an edge between vertices m and n with weight w. If an edge already exists, replace the weight of the edge with the new weight. If the vertices do not exist or are equal, throw an illegal argument exception.

// Friends

friend std::ostream &operator << ( std::ostream &, Weighted_graph const & );

};

const double Weighted_graph::INF = std::numeric_limits<double>::infinity();

// Enter definitions for all public functions here

std::ostream &operator << ( std::ostream &out, Weighted_graph const &graph ) {

// Your implementation

return out;

}

#endif

its a really long message i know but i would really appreciate if some1 could help with the coding

University of Waterloo Electrical and Computer Engineering Department.

Course: ECE 250

Instructor: Ladan Tahvildari.

Programming Assignment 4. Due date: December 3rd, 2012, 11:00 PM

As a teacher, this work ethic saddens me.

Course: ECE 250

Instructor: Ladan Tahvildari.

Programming Assignment 4. Due date: December 3rd, 2012, 11:00 PM

As a teacher, this work ethic saddens me.

Last edited on

Topic archived. No new replies allowed.