Hi,


I need an implementation of a directed acyclic graph. Both nodes and links 
should contain DAG user info, and 2 nodes may have 0 or more (acyclic) links 
between them. What could be a good implementation in J? Having a node I need to 
(efficiently) find both "following" and "preceding" nodes.


So far the best I have is an array of items, each item having 3 boxes. Item 
correspond to a node, first box contain node user info (actually, an integer - 
index in the separate array of user node data), second box contains the array 
of preceding nodes' indexes (integers, indexes in this same graph array, and 
integers may repeat as a preceding node may be connected by more than a single 
link) and the third box contains array of pairs "index of following node - 
index of link's user data in a separate array". So, third box contains N*2 
integers, where N is the number of links, starting in this node.

Doesn't look like particularly J style. Do you have any suggestions?

Thank you,

Alexander
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to