34 questions
0
votes
0
answers
49
views
Preventing loops when changing parent of a node in the adjacency list model of MySQL?
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 ...
0
votes
2
answers
1k
views
delete a specific node in a grapgh adjacency list -directed graph
hi there I have this struct info
struct Node
{
int dest, weight;
struct Node *next;
};
I want to build a function that removes a specific node distance value
my main function for calling the ...
5
votes
2
answers
2k
views
C++ Adjacency List Representation of Graphs
What is an efficient way to implement Adjacency List Representation of Graph in C++?
vector *edges;
list *edges;
map<int, int> *edges;
map<int, map<int, int>> edges;
In my opinion, ...
0
votes
1
answer
681
views
How to get data from MySQL hierarchical category tree using Adjacency List Model?
I am building a MySQL relational database with the InnoDB engine for a shopping application as an exercise (I am a noob, so sorry in advance for beginner question).
For product categories, I have ...
0
votes
2
answers
1k
views
Indented HTML <select> dropdown with hierarchical adjacency model MySql and PHP
My need is a very common select dropdown that displays hierarchical items where all child items are indented by adding I have gotten up to populating a dropdown in php with the right ...
0
votes
1
answer
406
views
Delete deeply nested subtree with ON DELETE CASCADE
I was looking into methods of deleting subtrees of trees stored in the adjacency list model. I set up this code, which deletes a complete tree using ON DELETE CASCADE. When I set max_ to a value > 14, ...
0
votes
1
answer
172
views
jqGrid TreeGrid Not Sorting Unless Nodes are Grouped
I have a jqGrid TreeGrid that I load from server sorted just fine, where the nodes contain assets (leafs). Some of the assets are grouped into assemblies where those nodes are expandable. When the ...
2
votes
1
answer
549
views
SQL complicated recursive CTE
I am working in SQL Server 2014. I have a strange data hierarchy situation. (At least, I haven't experienced something like it before.)
In my hierarchy, there are several root / highest-level ...
0
votes
1
answer
718
views
How to change this prim's algorithm function to take in and return an adjacency list?
I want to find the minimum spanning tree in a graph structured as an adjacency list. I was able to figure out the MST using Prim's algorithm but my current solution doesn't use an adjacency list.
...
10
votes
3
answers
5k
views
Properly plotting large adjacency matrix in R
I've got a rather large (but quite sparse) adjacency matrix (500x500) that I am trying to visually represent. It seems to me that something akin to a force directed graph is my best bet and while ...
0
votes
1
answer
68
views
Create an adjacency structure from a list of sequence
I would like to build an Adjacency List from my list of sequence in a php. The thing is, that my list of sequince is in array and it looks like this:
$arr = array("1", "1.1", "1.2", "2", "2.1", "2.1....
0
votes
1
answer
67
views
Yet another issue with BGL Deserialization [duplicate]
I'm trying to both serialize and deserialize the data in a graph format. The definition of my graph is the following one.
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/...
0
votes
1
answer
206
views
Adjacent List Model Tree, preventing loop
Example table:
CREATE TABLE adj_list_model (
id INT NOT NULL AUTO INCREMENT,
parent_id INT,
my_string varchar(255),//some random information
PRIMARY KEY (id)
)
The tree I am creating ...
5
votes
2
answers
6k
views
how to display an hierarchical structured database in tree view?
For some reasons need to display data from a mysql database in 2 different tree views.
Example
Tree view 1 (using list tag):
<li>level1 (Root)
<ul>
<li>level2</li>
...
2
votes
1
answer
2k
views
Adjacency List Model for User Types
I have a fairly large number of user types that I need in my database and so far the only good option that does not involve lots and lots of tables is to use Adjacency List Model. Basically, my users ...
3
votes
3
answers
2k
views
MySQL: Find all the leaf nodes of a subtree
I've a tree structure of categories stored in the mySQL table with category_id and parent_id relation. Parent_id = Null corresponds to the root node.
Category (category_id, category_name, parent_id)
...
26
votes
1
answer
16k
views
Adjacency List Model vs Nested Set Model for MySQL hierarchical data?
There are two ways to work with hierarchy data in MySQL:
Adjacency List Model
Nested Set Model
A major problem of the Adjacency List Model is that we need to run one query for each node to get the ...
3
votes
0
answers
351
views
Finding Descendants and Ancestors of Adjacency List in SQL Alchemy
If I have an adjacency list relationship as described by the Node class here, how would I get all of the descendants of that node?
All of the ancestors of that Node?
0
votes
2
answers
259
views
mysql self-join fixing result order when parent is doesnot exists
I i have a table named Taxonomy it preaty much holds everything that has to do with the structure of the organization. as a school example table looks like
id | name | type | parent
1 | 2014 | year |...
2
votes
1
answer
4k
views
multi level menu from database in codeigniter
I have a table in my database containing all of my database categories, which I need to convert into a multi-level menu. The table structure is below:
product_category_id | product_category_name | ...
0
votes
0
answers
1k
views
MySql Adjacency List with full tree parents
I want to use adjacency list model in MySql following this tutorial:
Managing Hierarchical Data in MySQL with query:
SELECT t1.name AS lev1, t2.name as lev2, t3.name as lev3, t4.name as lev4
FROM ...
1
vote
1
answer
599
views
Adjacency list model for site hierarchy, how to retrieve all pages in this particular order?
I have to admin I'm not a SQL-guru, maybe this query is really simple but I can't manage to write it. Basically all pages are arranged using the adjacency list model (I'm tracking the deep too):
+----...
1
vote
1
answer
2k
views
Grabbing child-nodes of parent using the adjacency model in MySQL
I'm having difficulty with the current model for my MySQL Table, namely that I can't seem to properly query all the child nodes of a specific parent. As the title states, I'm using the adjacency model....
0
votes
1
answer
216
views
Sorting non-nested array of data from adjacency model
I have an array of data fetched from a database table that uses the adjacency model to build a heirarchy of topics. Each record contains the following fields:
'id' - a unique AI id.
'name' - a display ...
0
votes
1
answer
1k
views
database design for online system using adjacency list model
i am trying to create a online shopping application using asp.net c# and mysql,
i have many categories which has two level subcategories and and some categories do not have subcategories somewhat like:...
1
vote
1
answer
790
views
Insert products into table in hierarchical relationship of category and parent in adjacent list model
i have a table category made up of adjacency list model:
id name parent_id
------------------------------
1 Clothing 0
2 Books 0
3 Computers 0
4 Mobiles ...
0
votes
1
answer
559
views
Sorting Adjacency List Children Alphabetically
If I have an adjacency list sorted by id/parent_id, is there an easy way to sort all of a parent's children alphabetically by a third text field (say "name")?
I have used information provided here: ...
1
vote
0
answers
254
views
How to adapt Jstree to use the Adjacency Model?
Jstree uses the nested set approach and while with static content this worked, we discussed our requirement with Ivan Bozhanov about re-using our table to allow each user to do operations with it and ...
0
votes
0
answers
478
views
Nested Set or Adjacency List Model for file permissions (MySQL)
Question:
What design should one use when storing all user file/folder permissions in a MySQL database?
Details:
I am having trouble deciding whether Nested Set requires far too much insert time ...
0
votes
1
answer
215
views
building a nested set
I need help with a project that I am working on: How do I calculate left and right in a Nested Set Model assuming all inputs come in in no particular order.
4 forms are distributed, each form brings ...
0
votes
1
answer
748
views
Adjacency List Model + Website Navigation
I am using the adjacency list model to find sub categories within my website. I have working PHP code to find all the categories and sub categories, but now I cannot figure out how use that to create ...
0
votes
1
answer
416
views
assistance on displaying data in colunm PHP MySQL (Modified Preorder Tree Trasversal)
Hello I'm trying to get a multicolumn display (if it can be called so) with the code below here is the result:
. Someone can see why These leaves are broken? or tell me please which is better: a ...
3
votes
1
answer
2k
views
Adjacency List Model with two tables
So I think my issue boils down to two questions:
How do I build a traversable tree structure in PHP when the tree is stored in MySQL (between two tables) using the Adjacency List Model approach while ...
4
votes
5
answers
2k
views
SQL to reorder nodes in a hierarchy
I've got a 'task list' database that uses the adjacency list model (see below) so each 'task' can have unlimited sub-tasks. The table has an 'TaskOrder' column so everything renders in the correct ...