Skip to main content
Filter by
Sorted by
Tagged with
2 votes
2 answers
103 views

I’m trying to implement a mutual friends feature using a graph data structure represented as an adjacency list in Python. Each node represents a person, and each edge represents a friendship (an ...
Durga's user avatar
  • 21
0 votes
2 answers
213 views

I have a simple adjacency list representation of a graph like this { 1: [2, 3, 4], 2: [5], 3: [6, 9], 4: [3], 5: [3], 6: [7, 8], 7: [], 8: [], 9: [] } which looks ...
Sachin Hosmani's user avatar
0 votes
1 answer
31 views

I am currently solving a problem concerning graphs in Data Structures in C++. The exercise says I should "build on the adjacency list representation of a graph, so that a field named data of type ...
benhpark's user avatar
1 vote
1 answer
115 views

I am writing code to take in a weighted adjacency list in C. Each edge is stored in the form of a struct. I created an array of pointers where each pointer leads to the list for a node. Here's what I ...
Jennie's user avatar
  • 35
1 vote
2 answers
178 views

Description: I have a set of coordinate points and an adjacency list that describes how each point (node) is connected to other points. Using these, I plotted a graph using NetworkX in Python. Here ...
Optical_flow_lover's user avatar
2 votes
1 answer
168 views

Aim: The aim is to develop a function that quickly traces sub-graphs for a list of nodes, given an existing adjacency list implementation, and returns a list of connected ID's in addition to the ...
modeller's user avatar
1 vote
1 answer
67 views

The problem statement is that there is a array with indices 1 to k which each contain a list that ranks l of n total items via order (i.e. list 1-2-3-4 is equivalent to 1>2>3>4). Is it ...
ESW_'s user avatar
  • 11
2 votes
1 answer
77 views

I need to calculate the adjacency matrix (in flat format) of a very large graph. Number nodes is 54327 and number edges is 46 million. The input are 46 million edges, so input looks like 1 6 2 7 1 6 3 ...
Eurico Covas's user avatar
1 vote
1 answer
71 views

I'm working on a college assignment, and in order to do the assignment, I need to have a program that simulates Depth-First Search for graphs represented with adjacency lists. To be clear; the ...
Austin's user avatar
  • 61
0 votes
1 answer
111 views

I am storing the open coords as two attributes in one list: self.x, self.y = [] My attempt at an edge list (lifted from stack overflow lol): edge = [] for i in self.x, self.y: for ...
iaivazovski's user avatar
0 votes
0 answers
102 views

I want to create a weighted adjacency list (with weight=length) in Python from a graph that I downloaded. Now, I struggle with creating such a list of the following form: adjacency_list = { 'A': [('C',...
pythagoreansnail's user avatar
-1 votes
1 answer
66 views

I am trying to delete the multiple occurring edges in a graph. Each vertex in the graph can have multiple outgoing edges to the same destination. like this one (this is the adjacency list). For ...
sf0831's user avatar
  • 1
1 vote
1 answer
75 views

I'm try to join a second table to hierarchical table in SQLAlechemy, and have the results of that join available to all levels the query. class NodeType(Base): id = Column(Integer, primary_key=...
fishDUDE's user avatar
1 vote
1 answer
100 views

My project is to create a graph with 1-2 milions nodes using adjacency list. Input data is from text file. I need to count the connected components and max/min degree of vetices of each components. My ...
bui hiep's user avatar
1 vote
1 answer
76 views

I want to create a graph with 2-3 million vertices using an adjacency list. The input is created randomly. When I ran a version that only prints out the increasing numbers of edges, it worked ...
bui hiep's user avatar
2 votes
1 answer
382 views

rootCategory is HasOne relation: public function rootCategory() { return $this->hasOne(PartnerCategory::class, 'partner_id', 'id')->where('partner_category_main', 1); } then: $categories = ...
rst630's user avatar
  • 89
0 votes
1 answer
91 views

The structure of the data in Stata looks something like this: id club_id 1 1 2 1 3 2 4 2 5 2 6 3 7 3 8 3 9 3 I assume that the network ...
Ele's user avatar
  • 7
0 votes
1 answer
232 views

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
1 vote
1 answer
90 views

I am programming in Visual Studio, but I need to perform validation on mySQL (v8.0.28) table and I guess it would be faster if it will be performed as procedure on server. Unfortunatelly, my MySQL ...
MadToolmaker's user avatar
0 votes
0 answers
49 views

I want the user to be able to change the parent of a node. However, there has to be some check so that the loop situation does not arise. For eg. Parent of 9 is 8. Parent of 8 is 7. User might assign ...
StackNewbie's user avatar
0 votes
0 answers
107 views

I have skeletonized 2D and 3D images as follows: 2D skeleton 3D skeleton Now, I want to analyze the skeletons in python and obtain the following information: The location of nodes. The adjacency list....
Mehdi MA.'s user avatar
-3 votes
1 answer
87 views

I have trying to make a clone of adjacency list in c++. But couldn't possibly do so. I have declared using: vector<int> adj[N]; // N is the number of vertices How do I make the clone of this ...
Rahul Gupta's user avatar
0 votes
1 answer
106 views

Can anyone explain to me why the space complexity of adjacency lists is Theta(m + n)? Example graph: a: b, c, d b : e c : d, e d : empty e : a So here n = 5, m = 7. Even crazier: The professor told us ...
CoderBendl's user avatar
0 votes
1 answer
392 views

Let G = (V, E) be an undirected, connected graph with n vertices and m > n edges. All vertices are initially un-marked and they are stored in an array V . Consider the following algorithm: ...
nitr0_nick03's user avatar
-1 votes
1 answer
165 views

I have understood and implemented Prim's and Kruskal's algorithm using adjacency matrix but I am not understanding how to write a program using adjacency lists I tried creating 2 matrices one for min ...
user20532639's user avatar
0 votes
1 answer
66 views

I have a set of <string, string> pairs which represents equivalency among them: [(“Player1”, “Player2”), (“Player3”, “Player4”), (“Player2”, “Player3”), (“Player11”, “Player13”)] This means, “...
dDebug's user avatar
  • 67
1 vote
1 answer
542 views

I have implemented a minimum cost path function to my undirected weighted graph using an adjacency list. My approach of the minimum cost path function does not use a priority queue. My goal is to ...
Sage's user avatar
  • 17
0 votes
1 answer
119 views

I'm learning how to create a graph using an adjacency list on Python. My current problem is when trying to add a node to the list, it displays the Node object at 0x0000.... instead of a string. When I ...
Sage's user avatar
  • 17
0 votes
0 answers
41 views

I'm making an adjacency list to represent a graph of roads, there are two kinds of weights (length and capacity) and for some reason this code never exits the for loop. it gets stuck on the cin for ...
Floor's user avatar
  • 1
0 votes
1 answer
133 views

I have a binary tree with devices attached to nodes (connected by an adjacency list). I'm trying to compare a device's value to the device downstream of it. I'm having trouble getting the downstream ...
Chris B.'s user avatar
-1 votes
1 answer
315 views

I was wondering how to create an adjacency list class Here is what I have so far: class AdjNode: def __init__(self, value): self.vertex = value self.next = None class Graph: ...
Rajesh Kumar's user avatar
0 votes
1 answer
211 views

I'm converting adjacency matrix to adjacency list. I need to add items to a dictionary and return it in a function, but output is the only last item. How to makes an output full list of items? def ...
guidedisp's user avatar
0 votes
0 answers
46 views

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
67 views

I need to convert format of my adjacency from list to a dictionary with following skeleton: def adjmat_to_adjlist(adjmat: List\[List\[int\]\]) -\> Dict\[int, List\[int\]\]: pass Here's what i ...
guidedisp's user avatar
0 votes
1 answer
424 views

I am trying to create an undirected graph using a text file with the following format: 0 5 4 3 0 1 9 12 6 4 5 4 0 2 11 12 I made a method to read the file and insert nodes/vertices into an arraylist. ...
RadaRada's user avatar
0 votes
1 answer
75 views

I have a hierarchy table: CREATE TABLE tmp.myTable ( [Id] int IDENTITY(1,1) PRIMARY KEY , [Desc] nvarchar(50) NOT NULL, [Lvl] TINYINT NOT NULL, [ParentId] int REFERENCES ...
Ibo's user avatar
  • 4,319
0 votes
1 answer
409 views

What does this line do? node.next = self.graph[src] EX: [1:2] here I know how to make 2 as a node, then make index 1 equal it, but what if i have [1:3] too, how to add 3 to 2? Here's the full code of ...
Heba Allah Hashim's user avatar
1 vote
1 answer
118 views

I have written this code for DFS traversal of graph represented using adjacency list in C. It is based on algorithm given in Cormen. The issue with this code is the while loop within "dfs_visit&...
Tetsuya Koruko's user avatar
1 vote
0 answers
129 views

I am studying the MIT introduction to algorithms (6.006) course and I could not understand the space complexity of representing a graph in the Adjacency matrix and Adjacency list. I have copied the ...
Ahmed Khalid's user avatar
0 votes
2 answers
233 views

Hi I am try to implement a graph using adjacency list using following code. #include<iostream> #include<list> #include<vector> #include<unordered_map> using namespace std; ...
Princy's user avatar
  • 5
0 votes
1 answer
219 views

My method "addEdge" adds a node to the adjacency list of the selected node, but I want the method to add the selected node to its adjacency list as well and turn it into an undirected graph. ...
mo_beezy's user avatar
1 vote
0 answers
61 views

I have an excel file that contains ~74000 entries, which are then stored into an array. I want to compare each element with each other (i.e compare [0] with [1], [2]. [3] .... then compare [1] with [0]...
NinjaWarrrior's user avatar
8 votes
1 answer
4k views

I want to define a model that has a self-referential (or recursive) foreign key using SQLModel. (This relationship pattern is also sometimes referred to as an adjacency list.) The pure SQLAlchemy ...
Daniel Fainberg's user avatar
0 votes
1 answer
688 views

I want to get full path in adjacency list Dijkstra algorithm using C++ queue. Graph edges are oriented. Dijkstra algorithm works fine and I understand why. However getting full path is a bit more ...
Vladislav Kogan's user avatar
0 votes
0 answers
207 views

I wrote some code that takes as input a graph (weighted) i've made and it calculates and prints all possible simple paths, and it also prints a sum of the total weight cost of each path. I want to be ...
DarkCloudsEverywhere's user avatar
1 vote
3 answers
127 views

As for many coding tests STL is not allowed so I am trying to implement vector class. To represent the graph I am using an adjacency list. It's giving me segmentation fault at new_allocation method. ...
Pratik Tushar Cholke's user avatar
1 vote
0 answers
150 views

I've been trying to implement this solution (https://algorithmist.com/wiki/UVa_10672_-_Marbles_on_a_tree) to this kattis problem (https://open.kattis.com/problems/marblestree). This is a graph theory ...
Ramsey Alsheikh's user avatar
1 vote
2 answers
64 views

I have a dataframe that stores adjacency relations. I want to divide numbers into different groups according to this dataframe. The dataframe are as follows: df = data.frame(from=c(1,1,2,2,2,3,3,3,4,4,...
showteth's user avatar
  • 438
0 votes
2 answers
221 views

#include<bits/stdc++.h> using namespace std; const int N=1e3; vector <int> graph2[N]; int main(){ int n,m; cin>> n>>m; for(int i=0;i<m;i++){ int v1,v2; ...
Reason Behind Tech's user avatar
0 votes
1 answer
523 views

Given a data model which contains reference to its parent (adjacency list): class Foo { public int Id { get; set; } virtual Foo Parent { get; set; } } How can I guarantee that no cyclic ...
Claude Hasler's user avatar

1
2 3 4 5
14