Presentation is loading. Please wait.

Presentation is loading. Please wait.

Directed Acyclic Graph Tool Alice Robson: UNIGE (with thanks to Colin Bernet)

Similar presentations


Presentation on theme: "Directed Acyclic Graph Tool Alice Robson: UNIGE (with thanks to Colin Bernet)"— Presentation transcript:

1 Directed Acyclic Graph Tool Alice Robson: UNIGE (with thanks to Colin Bernet)

2 1 0 8 2 3 7 4 5 6 Directed Acyclic Graph (DAG) Node represents an item Links between Nodes are directed Each Node can have multiple children multiple parents There are no cycles in the directed graph Aim of this implementation :- to support DAG where the Nodes may represent different types

3 DAG tool implements Visitor Pattern: It includes Node Class Visitor Class Interface BFSVisitorPattern Class (implementation of Visitor Class) Where T = Node content N = Node The Classes are deliberately kept simple. Users may also implement their own specialist visitors/or their own Node classes.

4 Node Class Implementation

5 Visitor Class Implementation

6 0 1 2 3 7 8 4 5 6 0 1 2 3 7 8 4 5 6 0 1 2 3 7 8 4 5 6 Breadth First Search Algorithm Visitor Pattern Eg Start at Node 0- traverseChildren returns Nodes: 0, 1, 2, 3, 4, 5, 6 traverseUndirected returns Nodes: 0, 1, 2, 3, 4, 5, 6, 7, 8 Start at Node 4 traverseParents returns Nodes: 4, 1, 7, 0, 8

7 Examples Three examples have been constructed - they use same graph structure - different types of content (1)Using Boost::Any: Node (2)Using Polymorphic classes: Node (3)Using a unique (encoded) long: Node

8 Boost:Any Allows any object to be wrapped inside. Very easy to wrap stuff up, To unravel requires working out what it is and casting to original type eg

9 Long Encoded Identifier The long encodes information about the Node contents eg Datatype (eg CLUSTER, TRACK, PARTICLE) SubType (eg RAW, SMEARED, MERGED) Unique long This is approach planned for PAPAS C++ FASTSIM implementation. Will be used alongside structures such as std::unordered_map Given a long encoded id – we can decide what it is and find the corresponding item.

10 Available on Git Hub https://github.com/alicerobson/DAG_tool Hoping to add other relevant examples as they become available.

11


Download ppt "Directed Acyclic Graph Tool Alice Robson: UNIGE (with thanks to Colin Bernet)"

Similar presentations


Ads by Google