adjacency-list Questions
1
Solved
I was wondering how to use C++11 smart pointers correctly for graph representations.
Suppose, you have a graph structure which contains a vector of all its vertices. Furthermore, you have a struct...
Zigrang asked 7/12, 2014 at 22:4
2
Solved
I am trying to generate a hierarchical tree object from a flat array with parent IDs.
// `parent` represents an ID and not the nesting level.
var flat = [
{ id: 1, name: "Business", parent: 0 },
...
Rhodos asked 24/1, 2014 at 21:15
1
I have a two-table hierarchical setup where table A references table B, which then references back to a different record in table A, and so on... but only up to a given recursion depth.
I have thi...
Incorporeal asked 7/12, 2010 at 21:20
3
Solved
I am trying to implement a graph in C++. I am representing a node in graph using a structure which contains two variables - a) an integer to contain some information about the node. b) a list to co...
Hollah asked 29/7, 2013 at 16:57
2
Solved
In C#, I have
class Pair{
int val1;
int val2;
}
I have a list of pairs coming from a source as:-
List<Pair> sList = new List<Pair>();
1 | 2
2 | 3
1 | 4
4 | 6
I need to con...
Loveinidleness asked 28/6, 2013 at 0:32
3
Solved
Given the following model:
create table child_parent (
child number(3),
parent number(3)
);
Given the following data:
insert into child_parent values(2,1);
insert into child_parent values(3,1...
Jeanette asked 28/4, 2013 at 10:55
3
Solved
Is there any effective way to, without limiting the depth, retrieve a single path in a Adjacency List model based on the node's ID? Like if I've got an ID for a node named "Banana" I could get the ...
Paramorphism asked 2/9, 2010 at 14:5
4
I have a DB like so:
id text parent
1 Parent 1 0
2 Child of 1 1
3 Sibling 1
4 Another Parent 0
5 A first child 4
So I'm trying to capture a tree structure my listing the parents. I'm aware o...
Morgen asked 22/11, 2010 at 4:27
4
Solved
I have a Table that stores Hierarchical information using the Adjacency List model. (uses a self referential key - example below. This Table may look familiar):
category_id name parent
-----------...
Moonraker asked 18/4, 2009 at 23:39
1
Solved
I was playing around (out of interest) with retrieving a tree of nodes in a simple adjacency list with a recursive query using local variables.
The solution i have so far is fun but i wonder (and...
Huck asked 9/7, 2012 at 21:53
2
Solved
For a while now I've been wrestling with how best to handle hierarchies in SQL. Frustrated by the limitations of adjacency lists and the complexity of MPTT/nested sets, I began thinking about simpl...
Obla asked 19/11, 2011 at 18:18
1
Solved
I'm preparing for a coding interview, and was refreshing my mind on graphs. I was wondering the following : in all places I've seen, it is assumed that adjacency lists are more memory efficient tha...
Redress asked 8/7, 2011 at 14:6
2
I'll admit this is my homework. The task statement said I have to write a program that finds a topological order of a graph which would be inputted by standard input. Then I need to submit it to be...
Dhu asked 12/3, 2011 at 17:39
2
Solved
I have a table which contains a location of all geographical locations in the world and their relationships.
Here is a example that shows the hierarchy. You will see that the data is actually store...
Bigamist asked 28/1, 2011 at 17:22
2
Solved
I've spent the last few hours trying to find the solution to this question online. I've found plenty of examples on how to convert from nested set to adjacency... but few that go the other way arou...
Apoloniaapolune asked 12/1, 2011 at 1:18
1
Solved
I want to create this Markov Chain in C#. I need to know if there is any other structure other than adjacency list which can work better in this situation. Also how can I use the existing .Net coll...
Unmeaning asked 6/5, 2010 at 14:38
2
Solved
Currently am developing a program that solves (if possible) any given labyrinth of dimensions from 3X4 to 26x30. I represent the graph using both adj matrix (sparse) and adj list. I would like to k...
Laurenelaurens asked 16/4, 2010 at 23:44
2
Solved
I have an adjacency list of objects (rows loaded from SQL database with the key and it's parent key) that I need to use to build an unordered tree. It's guaranteed to not have cycles.
This is taki...
Libido asked 16/4, 2010 at 16:34
1
Solved
I am using adjacency lists to represent a directed weighted graph and based on the example code provided by this SO question, I have created the following:
import java.util.HashMap;
import java.ut...
Aurilia asked 2/1, 2010 at 0:59
© 2022 - 2024 — McMap. All rights reserved.