Question: max() applied to a list composed of mixed integer/literals

Hi

I'm currently doing some proof of concept implementation of what comes closest to be described as "network flow" problem inside Maple. The current applicability is limited to one source and one sink, flows are not interesting, meaning the edge-costs are all equally set to 1. The chosen vector-based representation for a simple network (adjacency matrix)

 

  S 1 2 E
S 0 1 1 0
1 0 0 0 1
2 0 0 0 1
E 0 0 0 0

is as follows:

MM := [[2], S, [[1, 2], [[], 1], [[], 2]], E]

(context-free grammar might follow in a subsequent post). I need to find the highest integer in this list. My approach is as follows:

max(`minus`(convert(MM, set), {E, S}))

This seems a bit awkward but works. Is there a more elegant solution?

Please Wait...