Is there a convenient way to build a table as generated by the code below where a 5th column (at the far right) could be added to the table that is the sum of the edge weights for the nodes in a given row. Then also be able to sort that table from smallest edge weight sum to largest edge weight sum?
Clear[edges,g]
edges = {N1 -> N2, N1 -> N3, N1 -> N4,
N2 -> N5, N3 -> N5, N3 -> N6,
N4 -> N6, N5 -> N7, N6 -> N7};
g = Graph[
edges,
VertexLabels -> "Name",
EdgeWeight -> {1, 2, 3, 4, 5, 6, 7, 8, 9},
EdgeLabels -> {"EdgeWeight"},
EdgeLabelStyle -> Directive[Red, 20]
]
WeightedAdjacencyMatrix[g] // MatrixForm
TableForm[FindPath[g, N1, N7, Infinity, All]]
I'm looking for the sum of the edge weights of each row in the above table. For example, the last row would be generated as N1 N2 N5 N7 13, where 13 is the sum of the edge weights 1 (N1 -> N2) + 4 (N2 -> N5) + 8 (N5 -> N7) = 13. So, 13 would be the 5th column computed for each row in the above table generated by the last line of code in the above.