hierarchy

Increasing gap between nodes of my D3 tree layout

两盒软妹~` 提交于 2019-12-18 12:38:44
问题 As shown in the diagram, I am trying to increase the gap between last nodes on either side of the tree layout as they are overlapping Is there any way to do it in D3? { "name": "", "type": "network", "children": [{ "name": "", "type": "lb", "children": [{ "name": "", "type": "mm", "id": "app", "connServer": "s", "size": 3938 }] }, { "name": "", "type": "vm", "children": [{ "name": "", "type": "container", "children": [{ "name": "", "type": "appServer", "id": "app1", "connServer": "db1", "size

SQL Data Hierarchy

假装没事ソ 提交于 2019-12-18 11:13:10
问题 I have looked through a few SQL hierarchy tutorials, but none of them made much sense for my application. Perhaps I am just not understanding them correctly. I'm writing a C# ASP.NET application and I would like to create a tree view hierarchy from SQL data. This is how the hierarchy would work: SQL TABLE ID | Location ID | Name _______| __________ |_____________ 1331 | 1331 | House 1321 | 1331 | Room 2141 | 1321 | Bed 1251 | 2231 | Gym If the ID and Location ID are the same, this would

proper class hierarchy for 2D and 3D vectors

江枫思渺然 提交于 2019-12-18 06:16:10
问题 I want to have a general vector abstract class / trait that specifies certain methods, e.g.: trait Vec { def +(v:Vec):Vec def *(d:Double):Vec def dot(v:Vec):Double def norm:Double } I want to have Vec2D and Vec3D extend Vec : class Vec2D extends Vec { /* implementation */ } class Vec3D extends Vec { /* implementation */ } But how can I, for instance, make it so that Vec2D can only be added to other Vec2D and not to Vec3D ? Right now I'm just implementing Vec2D and Vec3D without a common Vec

Import Error. Circular References

大兔子大兔子 提交于 2019-12-17 20:15:46
问题 I have a package like this package/ __init__.py subpackage1/ __init__.py moduleA.py moduleB.py moduleC.py moduleD.py subpackage2/ __init__.py moduleX.py moduleY.py moduleZ.py In moduleB.py, I am importing from moduleA import bar In moduleA, I am importing from moduleB import foo I am getting ImportError. ImportError: cannot import name foo What could be the problem here ? and to avoid this problem, what should I do ? and what should I write in _ init _ .py pf package, subpackage1, subpackage2

Getting all the children of a parent using MSSQL query

别等时光非礼了梦想. 提交于 2019-12-17 19:22:01
问题 I have the following data in my database: Parent Child 101 102 101 103 101 104 101 105 101 106 My parameter is 106. And using the parameter I want to retrieve all the other children under its parent which is 101. I tried using the recursive method but it didn't work given the following data. Is there another way to formulate a query? 回答1: Assuming you want to get siblings of the value @p0 , you can use a simple self-join: SELECT p.Child FROM Table1 c INNER JOIN Table1 p ON c.Parent = p.Parent

MySQL Recursive get all child from parent

天大地大妈咪最大 提交于 2019-12-17 18:57:42
问题 i have this case using recursive query on Mysql to find lv 2 and lv3 child on one table... database structure i'm using: id name parent 1 A 0 2 B 0 3 C 0 4 D 1 5 E 1 6 F 2 7 G 2 8 H 3 9 I 3 10 J 4 11 K 4 The result i was expecting, when filtering the data, where id=1, it will generate the result i'm expecting. id name parent 4 D 1 5 E 1 10 J 4 11 K 4 or this is the illustration. i've been looking everywhere, and reading this http://mikehillyer.com/articles/managing-hierarchical-data-in-mysql/

How can I create a closure table using data from an adjacency list?

旧街凉风 提交于 2019-12-17 18:36:38
问题 I have a database containing a hierarchy of categories stored using the adjacency list model. The hierarchy is 3 levels deep (not including an imaginary root node) and contains approx 1700 nodes. Nodes in the 2nd and 3rd levels can have multiple parents. A additional table is used for the many-to-many relationship as below: CREATE TABLE dbo.Category( id int IDENTITY(1,1) NOT NULL, name varchar(255) NOT NULL, ) CREATE TABLE dbo.CategoryHierarchy( relId int IDENTITY(1,1) NOT NULL, catId int NOT

How can I generate a hierarchy path in SQL that leads to a given node?

痴心易碎 提交于 2019-12-17 17:02:52
问题 In my MS SQL 2008 R2 database I have this table: TABLE [Hierarchy] [ParentCategoryId] [uniqueidentifier] NULL, [ChildCategoryId] [uniqueidentifier] NOT NULL I need to write a query that will generate all paths that lead to a given Node. Lets say it I have the following tree: A -B --C -D --C Which would be stored as: NULL | A A | B A | D B | C D | C When asking for the Paths for C, I would like to get back two paths (written more or less like this): A > B > C, A > D > C 回答1: Here is my

Is there a way to detect a cycle in Hierarchical Queries in SQL Server?

半腔热情 提交于 2019-12-14 03:52:15
问题 In Oracle, we can use the function CONNECT_BY_ISCYCLE to detect a cycle in Hierarchical Queries. I try to do the same in SQL Server. Is there a way to do this? Thanks a lot! 回答1: Concatenate the records IDs / build a bitmap based on ROW_NUMBERs of the records and verify each new record against the list/bitmap create table t (id int,pid int) insert into t values (1,3),(2,1),(3,2) List Identify Cycles with cte (id,pid,list,is_cycle) as ( select id,pid,',' + cast (id as varchar(max)) + ',',0

Flatten parent child hierarchy with multiple parents

霸气de小男生 提交于 2019-12-13 22:01:55
问题 I have a parent-child hierarchy in my source structure where a child could point to his parent and for his parent could exist multiple rows. If we than flatten the hierarchy this would mean that every child row need to exist beneath his parent row. Image below to clarify I have already picked out my brains how to resolve this in a performant manner in T-SQL because my source set is 300K rows and this will lead to heavy processing. Help is greatly appreciated! Code to directly start from the