def psudo_graph(transactions):
    """
    Key
        prefix - out going edges
        postfix - in comming edges 
    """
    pg=dict()
    for transaction_id, transaction in enumerate(transactions):
        for i in range(len(transaction)):
            u=transaction[i]
            if i != len(transaction) - 1:
                v=transaction[i+1]
                if u not in pg:
                    pg[u]={"prefix":{transaction_id:v}, "postfix": dict()}
                else:
                    pg[u]["prefix"][transaction_id]=v
                if v not in pg:
                    pg[v]={"prefix":dict(), "postfix": {transaction_id:u}}
                else:
                    pg[v]["postfix"][transaction_id]=u
    return pg