{"action":"opened","issue":{"url":"https://api.github.com/repos/dedis/cothority/issues/295","repository_url":"https://api.github.com/repos/dedis/cothority","labels_url":"https://api.github.com/repos/dedis/cothority/issues/295/labels{/name}","comments_url":"https://api.github.com/repos/dedis/cothority/issues/295/comments","events_url":"https://api.github.com/repos/dedis/cothority/issues/295/events","html_url":"https://github.com/dedis/cothority/issues/295","id":142747695,"number":295,"title":"Identifying Positions of TreeNodes in Trees","user":{"login":"Daeinar","id":1496810,"avatar_url":"https://avatars.githubusercontent.com/u/1496810?v=3","gravatar_id":"","url":"https://api.github.com/users/Daeinar","html_url":"https://github.com/Daeinar","followers_url":"https://api.github.com/users/Daeinar/followers","following_url":"https://api.github.com/users/Daeinar/following{/other_user}","gists_url":"https://api.github.com/users/Daeinar/gists{/gist_id}","starred_url":"https://api.github.com/users/Daeinar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Daeinar/subscriptions","organizations_url":"https://api.github.com/users/Daeinar/orgs","repos_url":"https://api.github.com/users/Daeinar/repos","events_url":"https://api.github.com/users/Daeinar/events{/privacy}","received_events_url":"https://api.github.com/users/Daeinar/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-03-22T19:05:23Z","updated_at":"2016-03-22T19:05:23Z","closed_at":null,"body":"In certain situations it would be good to be able to quickly identify the `index` of a given `TreeNode` in a given `Tree`  **or** given an `index` and a `Tree` get the corresponding `TreeNode`.\r\n\r\nBy `index` I mean here the unique integer when you flatten the `Tree` to a list (e.g. via `ListNodes()`)\r\nthat has been flattened to a list \r\n\r\n\r\n My first impulse was to put a simple `int` in the `TreeNode` struct which is initialised as soon as the `Tree` has been established and be done with it. However, since a cothority `Node` is designed to be stateless allowing to run multiple instances of various protocols and since a `TreeNode` is embedded in a `Node` they are in a one to one\r\n\r\n As far as I remember, cothorities also support running multiple instances of multiple protocols \r\n\r\nNeed Node uuid and Tree uuid to determine integer position\r\n\r\nNode -> uuid -> Tree\r\n\r\nGoals:\r\n- Given an integer *and* a tree uuid get the  node\r\n- Given an node uuid *and*  a tree uuid get an integer\r\n\r\nIs it worth it, or should we handle it on a per-protocol basis and let the protocol designers take care of that?"}}