The von Koch conjecture You may know the mathematician von Koch by his famous snowflake. However he has more interesting computer science problems up his sleeves.
Indeed, let's take a look at this conjecture:

Given a tree with n nodes (thus n-1 edges). Find a way to enumerate the nodes from 1 to n and, accordingly, the edges from 1 to n-1 in such a way, that for each edge k the difference of its node numbers equals to k. The conjecture is that this is always possible.

Here's an example to make it perfectly clear : 



YOUR TASK 

Your code will take as input a tree, you can take the format you want but for the test cases I will provide the tree by their arcs and the list of their nodes.

For example this is the input for the tree in the picture : 

[a,b,c,d,e,f,g]
d -&gt; a
a -&gt; b
a -&gt; g
b -&gt; c
b -&gt; e
e -&gt; f


Your code must return the tree with nodes and edges numbered. 
You can return a more graphical output but I will provide this kind of output for the test cases : 

[a7,b3,c6,d1,e5,f4,g2]
d -&gt; a 6
a -&gt; b 4
a -&gt; g 5
b -&gt; c 3
b -&gt; e 2
e -&gt; f 1


TEST CASES

[a,b,c,d,e,f,g]             [a7,b3,c6,d1,e5,f4,g2]
d -&gt; a                      d -&gt; a 6
a -&gt; b                      a -&gt; b 4
a -&gt; g             =&gt;       a -&gt; g 5
b -&gt; c                      b -&gt; c 3
b -&gt; e                      b -&gt; e 2
e -&gt; f                      e -&gt; f 1


[a,b,c,d]                   [a4,b1,c3,d2]
a -&gt; b                      a -&gt; b 3
b -&gt; c            =&gt;        b -&gt; c 2
b -&gt; d                      b -&gt; d 1


[a,b,c,d,e]                [a2,b3,c1,d4,e5]
a -&gt; b                      a -&gt; b 1
b -&gt; c                      b -&gt; c 2
c -&gt; d             =&gt;       c -&gt; d 3
c -&gt; e                      c -&gt; e 4


This is code-golf this the shortest answer in bytes win!

Note : This is stronger than the Ringel-Kotzig conjecture, which states every tree has a graceful labeling. Since in the Koch conjecture it is not possible to skip integers for the labeling contrary to the graceful labeling in the Ringel-Kotzig conjecture.  Graceful labeling has been asked before here.
Jelly, 30 bytes

JŒ!³,$€
Çµy⁴VIAµ€Q⁼$€TðḢịø³JŒ!


Try it online! (Use GṄ³çG as footer to make output prettier. )

Inputs similar to example, e.g. abcdef and [d,a],[a,b],[a,g],[b,c],[b,e],[e,f]

Outputs the list e.g. a,b,c,d,e,f in order.

Note: My program produces different values than the test cases as there are several possibilities which are all valid.

Explanation

JŒ!³,$€                - helper function, generates all possible numberings, input is e.g. 'abcd'
J                      - range(len(input)). e.g. [1,2,3,4]
 Œ!                    - all permutations of the range.
   ³,$                 - pair the input with ... 
      €                - each permutation. Sample element e.g. ['abcd',[3,1,2,4]]

Çµy⁴VIAµ€Q⁼$€TðḢịø³JŒ! - main dyadic link, input is e.g. 'abcd' and '[a,b],[b,c],[b,d]'
 µy                    - use a numbering as an element-wise mapping e.g. 'abcd'-&gt;[3,1,2,4]
   ⁴                   - apply this to the list of edges. e.g. '[3,1],[1,2],[1,4]'
    V                  - turn this into an internal list.
     IAµ€              - find absolute difference on each edge
         Q⁼            - Is this invariant under deduplication? Returns 1 if the numbering is valid; 0 otherwise.
Ç          $€          - apply this to all possible numberings
             Tð        - return the indices of all valid numberings
               Ḣ       - choose the first one and
                ị      - get the element corresponding to its index in 
                 ø³JŒ! - all possible numberings 


Save 1 byte by showing all possible solutions:

JŒ!³,$€
Çµy⁴VIAµ€Q⁼$€Tðịø³JŒ!


Try it online! (Use GṄ³çG⁷³G as a footer to make output prettier)

Use converter to copy-paste test case into an input list.