dfs+dp Question

We have a non simple graph,that have the property that transitive edges share the same token(weight of edge).We have to verify if such property exists in the graph.I do a dfs from a random vertex and store the result in a temporary dp matrix dp[prev][root].But how do we verify the property using brute force or dsu .It would be helpful if you would provide the pseudocode.