473,545 Members | 1,479 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Finding predecessors in DAGs without traversal or search. Is it possible?

Background:
In trees, there are a two or three ways (maybe more) to find out if
Node A is an ancestor of Node B without traversing the tree.

Preprossing is OK, and one of the solutions I am aware of is here:

"Use [depth first search] pre- and post-order numbers. Na is an
ancestor of Nb iff
pre(Na) < pre(Nb) and post(Na) > post(Nb)."
See
http://groups.google.com/group/comp....coring=d&hl=en

My question:
-------------------
What if, instead of a tree, we have a DAG (i.e., a directed graph with
no directed cycles)? Is it possible to find out if Node A is
predecessor of Node B (in the topological order) without searching or
traversing the graph? Assuming it might be possible, what specific
methods could we use to find out about the predecessorship in this way?
Preprocessing is OK, just as it was in the case of the trees.
P.S.
-------
In case anyone wants to know, I'm asking this in the context of some
RBAC (role-based access control) code I'm designing. The design is not
finished, but the role hierarchy may allow a node to have multiple
parents and it may also allow inheritance of permissions (rights) to be
directed either upward or downward, as proposed here:

Crampton, J. 2003. On permissions, inheritance and role hierarchies. In
Proceedings of the 10th ACM Conference on Computer and Communications
Security (Washington D.C., USA, October 27 - 30, 2003). CCS '03. ACM
Press, New York, NY, 85-92. DOI=
http://doi.acm.org/10.1145/948109.948123

If I end up using something remotely similar to that, I first want to
determine whether I could make it as performant as the solution using
rooted trees (i.e., no roles with multiple parents and all inheritance
of permissions in the upward direction).

Apr 28 '06 #1
4 1774

Mountain wrote:
Background:
In trees, there are a two or three ways (maybe more) to find out if
Node A is an ancestor of Node B without traversing the tree.

Preprossing is OK, and one of the solutions I am aware of is here:

"Use [depth first search] pre- and post-order numbers. Na is an
ancestor of Nb iff
pre(Na) < pre(Nb) and post(Na) > post(Nb)."
See
http://groups.google.com/group/comp....coring=d&hl=en

My question:
-------------------
What if, instead of a tree, we have a DAG (i.e., a directed graph with
no directed cycles)? Is it possible to find out if Node A is
predecessor of Node B (in the topological order) without searching or
traversing the graph? Assuming it might be possible, what specific
methods could we use to find out about the predecessorship in this way?
Preprocessing is OK, just as it was in the case of the trees.


In a preprocessing pass, compute the transitive closure of the DAG.
There are several well-known efficient algorrithms for this. Perhaps
the best-known is Warshall's Algorithm.

Apr 28 '06 #2
Mountain wrote:
What if, instead of a tree, we have a DAG (i.e., a directed graph with
no directed cycles)? Is it possible to find out if Node A is
predecessor of Node B (in the topological order) without searching or
traversing the graph? Assuming it might be possible, what specific
methods could we use to find out about the predecessorship in this
way? Preprocessing is OK, just as it was in the case of the trees.


This sounds like the same problem as sub-type checking in the presence
of multiple inheritance (as in Java interfaces). I recommend (again)
that you to Google for:

fast subtype checking

Ware patents!

-- chris
Apr 28 '06 #3

Chris Uppal wrote:
This sounds like the same problem as sub-type checking in the presence
of multiple inheritance (as in Java interfaces). I recommend (again)
that you to Google for:

fast subtype checking


I should have done that the first time. That proved very fruitful.
Thanks.

Apr 28 '06 #4

Mountain wrote:
My question:
-------------------
What if, instead of a tree, we have a DAG (i.e., a directed graph with
no directed cycles)? Is it possible to find out if Node A is
predecessor of Node B (in the topological order) without searching or
traversing the graph? Assuming it might be possible, what specific
methods could we use to find out about the predecessorship in this way?
Preprocessing is OK, just as it was in the case of the trees.


I think I'm on the right track, and I appreciate the help from the
group! However, work deadlines are such that a few more quick answers
would be really, really helpful.

Given an hierarchy such as in multiple subtyping (or a DAG as I
proposed above), I see that there are several ways to perform efficient
tests for subtypes (type inclusion tests /predecessor tests).

Are there variations on this that will find the least common ancestor
of two types in constant time using techniques like the binary matrix
encoding? (I actually don't care which techiques are used, but I am
primarily after runtime efficiency.)

Apr 28 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
2278
by: Bilal | last post by:
Hi, I have a web application that operates on several windows. Each window is named win_1, win_2, win_3,... . When I quit a session, I usually loop through all the windows and close one by one. So far so good until my client wants to surf on 1 particular window and doesn't want that window to close when a I quit a session. I had something in...
13
15201
by: yaipa | last post by:
What would be the common sense way of finding a binary pattern in a ..bin file, say some 200 bytes, and replacing it with an updated pattern of the same length at the same offset? Also, the pattern can occur on any byte boundary in the file, so chunking through the code at 16 bytes a frame maybe a problem. The file itself isn't so large,...
2
1633
by: normd | last post by:
Am I doing something dumb? Ween searching for posts in this system I enter words from my posts - that I know are in there - and the search keeps coming back with nothing found. I entered the original; I KNOW it is there Further, I search, as a test, for posts I'm looking at on the screen and using words from their subject line, and it tells...
0
2260
by: Helge Jensen | last post by:
Having posted in microsoft.public.dotnet.framework.sdk and microsoft.public.dotnet.framework.wmi without receiving any response, I posthere on the off-chance that someone who isn't following those groups knows a solution. I'm using code (roughly like): using System; using System.Management; public class Foo {
2
13874
by: AD | last post by:
Hi, I know it is not exactly a C++ problem but rather concerns algorithm. But I could not figure out any other group to post this so am posting here. I am looking for the algorithm proposed by Morris for inorder traversal of a Binary Tree without using explicit stack. Searched on net but could not find many clues.
2
3221
by: mdeni | last post by:
I am sorry if this was allready asked or discussed, please redirect me. I have to make the program of postorder traversal of the binary search tree NOT using recursion. I have found many solutinos using recursion but I can't figure 1 without recursion. Can you help me and tell me the code? Please. With recursion: void postorder(struct node...
6
4061
by: GrispernMix | last post by:
//ques and and level order traversal file name: lab6_build_leaf_up.cpp Instructions:
9
15239
by: nishit.gupta | last post by:
Can somebody please help me for algorithm for postorder bst traversal without recursion. It should use stack. i am not able to implement it. thnx
2
3801
by: slizorn | last post by:
hi guys, i need to make a tree traversal algorithm that would help me search the tree.. basically i need to read in a text file... shown below H H,E,L E,B,F B,A,C A,null,null c,null,D
0
7457
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7391
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7802
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7746
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5962
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
4941
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3443
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1010
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
693
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.