code: def set_hierarchy_probs(self, statements):
          def build_hierarchy_graph(stmts):
              g = networkx.DiGraph()
              for st1 in stmts:
                  g.add_node(st1.matches_key(), stmt=st1)
                  for st2 in st1.supported_by:
                      g.add_node(st2.matches_key(), stmt=st2)
                      g.add_edge(st2.matches_key(), st1.matches_key())
              return g
          def get_ranked_stmts(g):
              node_ranks = networkx.algorithms.dag.topological_sort(g)
              node_ranks = reversed(list(node_ranks))
              stmts = [g.node[n]['stmt'] for n in node_ranks]
              return stmts
          def assert_no_cycle(g):
              try:
                  cyc = networkx.algorithms.cycles.find_cycle(g)
              except networkx.exception.NetworkXNoCycle:
                  return
              msg = 'Cycle found in hierarchy graph: %s' % cyc
              assert False, msg
          g = build_hierarchy_graph(statements)
          assert_no_cycle(g)
          ranked_stmts = get_ranked_stmts(g)
          for st in ranked_stmts:
              bps = _get_belief_package(st)
              supporting_evidences = []
              for bp in bps[:-1]:
                  for ev in bp.evidences:
                      if not ev.epistemics.get('negated'):
                          supporting_evidences.append(ev)
              belief = self.scorer.score_statement(st, supporting_evidences)
              st.belief = belief