Hello all, I would like to first state that it this is a question for a homework assignment, so I'm not looking for exact code but rather just help on something that is frustrating me. We have to create our own ADTs for this assignment and not use built in classes. So here is what I've got so far: for the Edge class (basically like a Node class): class Edge { int vertex1; int vertex2; float weight; Edge next; public Edge(int v1,int v2,float w,Edge n) { this.vertex1 = v1; this.vertex2 = v2; this.weight = w; this.next = n; } public …

Member Avatar
Member Avatar
+0 forum 5

I need to write an algorithm for finding the maximum weighted independent set of a graph, G. Any idea of where I should start?

Member Avatar
Member Avatar
+0 forum 1

I am trying to create a graph from a 2d matrix of booleans. When the index [i][j] == 1, I need to create a link or edge from node[i] to node[j]. I am doing some thing wrong. I have created a class file with a struct node and some basic operations. I have realized a pointer of the struct in not the correct way to go about this. A node may have more than one edge to other nodes, and one pointer is not going to link them. Please help a struggling programming student. My code and output is listed …

Member Avatar
+0 forum 0

I am currently working on kind of multi-graph structure. The thing is that two graphs are needed for my application which span the same vertices but with two distinct set of edges (i.e., a multi-graph). The first graph is a binary search tree, while the second graph must be general (directed / undirected, or bidirectional, possibly with cycles, etc.). The B-tree is used for fast queries of nearest nodes, while the second graph is needed for path-planning (e.g., in the style of shortest-path algorithms). Both graphs have to be completely mutable (reconnections, moving nodes around, adding/removing nodes and edges to …

Member Avatar
Member Avatar
+0 forum 12

Hello, I'm working on an assignment right now and I need some feedback. My project is to implement a graph that uses an adjacency list like an Edge list. I'm fairly new with these and I would apprecite if anyone can see my code if I'm on the right track. Thanks! #include<iostream> #include<string> #include<list> using namespace std; #define D true #define U false #define W true #define N false #define MAX 100 class Edge { public: Edge() { } Edge(int from, int to, double weight = -1) : from (from), to (to), weight (weight) { } Edge(const Edge & other) …

Member Avatar
Member Avatar
+0 forum 2

I needed to implement a simple cyclic graph in Java so it have nodes in such a way that it can be implemented to represent adjacency matrix or list. Any advice or resources to hep me start implementing this would be much appreciated! Many Thanks

Member Avatar
Member Avatar
+0 forum 3

I have a Graph that I'm making using an adjacency matrix to hold edge values. The noEdge value is zero and all edgeweights are positive integers. I have to delete a node from this graph and I'm having trouble figuring out how to update the Adjacency matrix after the deletion of the label from my labels vector. I know I have to shift the values but I can't quite figure out in code/algorithm format. Any idea on a good way to implement this in code/an algorithm? Thanks

Member Avatar
Member Avatar
+0 forum 1

[CODE] #include<iostream> #include<time.h> #include<conio.h> using namespace std; class adclist { struct list { int data; list* next; }; public: void makelist(); }; void adclist::makelist() { list** table = new list* [10]; for(int j =0; j < 10 ; j++) table[j] = NULL; for ( int m =0; m < 10; m++) { int x; cout<<"enter your value"<<endl; cin>>x; list* newptr = new list; newptr->data = x; newptr->next = NULL; int y = rand() %9 ; //................................................. // WHATS THE MISTAKE IN THIS SEGMENT..........??????????? list* head = new list; head = table[y] ; if (head == NULL) { head->data = x; …

Member Avatar
Member Avatar
+0 forum 3

Hokay so, i gotta make a program that reads an adjacency matrix from a data file and then outputs which nodes are adjacent to the others. In the data file there are 0's and 1's, 0 means that they are not connected and a 1 means that they are. I got some of my code that allows me to remove and insert necessary nodes in the correct spot however im an stumped on my int main(){ and have no clue on what direction i should go or where i should start any comments would be much appreciated. [CODE] #include <iostream> …

Member Avatar
Member Avatar
+0 forum 3

The End.