public static Weighted < Arborescence < Node > > getMaxArborescence ( WeightedGraph graph , Node root ) { // remove all edges incoming to `root`. resulting arborescence is then forced to be rooted at `root`. return getMaxArborescence ( graph . filterEdges ( not ( DirectedEdge . hasDestination ( root ) ) ) ) ; }
Find an optimal arborescence of the given graph graph rooted in the given node root .