At each node within the tree, randomly choose a child to follow: that PR/element is within your game. Define subgraphs to enclose certain portions of the tree, corresponding to the amount of players within the game.
Creating a "balanced" structure (lol) will take some time, but this is obviously a novel development in mafia setups.
Game will always have a Goon, RB
50/50 to have a Cop/Tracker. if cop -> add Godfather otherwise add Goon2
50/50 to have a Doctor/Jailor. if doctor -> 50/50 masons+goon3/strongman otherwise 50/50 vigi+strongman/goon3
This is a prototype, concept art. Once I gather some funding, I'll write code to simulate mafia games and then utilize a genetic algorithm to come to the optimally most balanced mafia tree.
I do like the start.
If town get a cop, mafia get a roleblocker or a godfather. Nice counter.
Town only get a cop and doc if mafia have a roleblocker. Smart. Follow the Cop is a game ruiner.
Not sure about the rest.
Also, the tree would depend on the number of players.
When I tried this with a variable number of players, I failed and gave up.