Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
0 votes
1 answer
211 views

How to optimize memory footprint of a graph with large amount of vertex?

I was tasked my my prof to solve a graph question. However, he hinted that one of his hidden test cases that I failed have over 80k, my code would fail as it exceeded the amount of memory that was ...
Shreamy's user avatar
  • 361
0 votes
0 answers
43 views

Compare character by character of strings from an array efficiently

Palavras = (char***)malloc(maxLen*sizeof(char**)); matrizAdj = (int***)malloc(maxLen*sizeof(int**)); for(i=0; i<maxLen; i++){ Palavras[i]= (char**)malloc(NMax_Palavras[i]*sizeof(char*)); ...
Luis Ventura's user avatar
0 votes
0 answers
293 views

ALL shortest paths between a given node and a destination

I want an algorithm to find ALL the shortest paths between source S and destination E. I know that Dijkstra's algorithm can find one of the shortest paths, but I'm stuck at finding an algorithm for ...
alexa's user avatar
  • 1
1 vote
1 answer
2k views

Converting an Adjacency Matrix to an Adjacency List in C

I am supposed to convert a given adjacency matrix to an adjacency list in C. I need this adjacency list because this is where I will implement my algorithm for Depth First Search (DFS). Before I write ...
mrkupidooo's user avatar
1 vote
1 answer
317 views

I am trying to implement BFS using adjacency matrix in C,but my code is not processing the dequeue function after the first row

I am implementing BFS in C language using adjacency matrix. I am using queues(linked list) to perform the enqueue and dequeue operations. My code is dequeuing the first vertex,i.e. 1 but after than ...
Amar's user avatar
  • 13
1 vote
2 answers
46 views

adjacency matrix don't alloc properly

I have a graph structure with v representing number of nodes, and **adjmatrix which is the adjacency matrix, i have a problem to initialize all elements with 0, I get segmentation fault at adjmatrix[0]...
Sicoe Mircea Cristian's user avatar
0 votes
0 answers
135 views

How do I use the adjacency matrix

Hey I am new to programming and trying to store the following graph in an adjacency matrix I am not sure how to go about doing it. I want my code to read the graph information and store it in a data ...
Usama Navid's user avatar
1 vote
0 answers
60 views

Problem returning to Origin Node using Adjacency Matrix

I have to run all USA cities(41 in the map we were given) using an adjacency matrix. The user must type the origin node, and then the algorithm has to run all USA cities, and then return to the ...
Raven's user avatar
  • 81
0 votes
1 answer
366 views

Is it possible to construct an adjacency matrix for a graph without storing indexes of nodes

I have managed to implement the solution with storing an index of each node, but is it possible to it without the indexes? My assignment is to implement a bloxrolz game, sort of. In the example I'm ...
remax's user avatar
  • 29
0 votes
1 answer
2k views

Implementing 2D Grid Network ( Graph ) and Adjacency Matrix of it in C

I want to create a 2d Grid graph with 10000 Nodes ( actually 100*100 ) with periodic conditions in C . I don't know exactly how should I do that ? after that I want to get adjacency matrix of that ...
yahya hematyar's user avatar
3 votes
1 answer
431 views

C implementation of an algorithm for flow resolution with non-weighted, bidirectional edges, and nodes with flow capacity

I have tried looking in stack overflow for an answer to my question. I've found those answers, but their solution doesn't really apply to my case, as I have non-directed edges. I cannot create a new ...
chbp's user avatar
  • 321
1 vote
2 answers
1k views

C program that uses depth-first search to count the number of distinct graphs represented by an adjacency matrix

The code below uses depth-first search over all elements of an adjacency matrix to count how many graphs are represented in the adjacency matrix. For some reason this code works only for some test ...
Ruan's user avatar
  • 922
0 votes
1 answer
316 views

Segmentation fault when adding edge to graph

I have to use an undirected weighted graph (adjacency matrix) for this program. typedef struct graph { int n; /* Number of vertices */ Boolean *visited; /* Will be later used */ double **...
Roger M's user avatar
  • 107
0 votes
3 answers
84 views

Extra edge in my list?

I'm writing code to create a matrix out of a list of edges. However, when I run said code, I get a "phantom edge" that is not in the input data, which goes on to screw up the rest of my program. The ...
ZAX's user avatar
  • 1,006
0 votes
1 answer
2k views

Static allocated adjacency matrix Graph in C

I want to put in a adjacency matrix the following graph: The left figure is a node link representation of an 8 node network. The right one is an adjacency matrix representation of the same network. ...
edgarmtze's user avatar
  • 25.1k

15 30 50 per page