Thanks Raul,
Raul Miller schrieb:
You can eliminate them by explicitly discarding them
([: ; [: -.&a: <@(g&search_paths)"_ 1)&.>^:0 1 2 3 <,:_ 1
+---+-----+-------+-----+
|_ 1|5 1 2|5 1 2 3| |
| |7 1 3| | |
+---+-----+-------+-----+
Note also that boxing and razing achieves the same end as ,/
Great, the latter is what I am going to use.
To deal with your termination problem, I think that you
should change your definition for search_paths:
search_paths =: 4 : 0
NB. t =: ending vertex not within path and starting vertex equals path end
t=.( -.({:"1 x) e. }.}: y)*.(1{"1 x)={:y
r=.(({. y)<.t#{."1 x) ,.(}. y),"1 0 t#{:"1 x
if.0=#r do.,:y else.r end.
)
_1 {:: ([: ; [: -.&a: <@(g&search_paths)"_ 1)&.>^:a: <,:_ 1
5 1 2 3
7 1 3 0
Good suggestion, but in my case the graph contains one source and one
target vertex,
and only the paths reaching from source to target are of interest.
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm