Skip to content

Latest commit

 

History

History
34 lines (28 loc) · 599 Bytes

File metadata and controls

34 lines (28 loc) · 599 Bytes

#LCS Finding the Longest Common Subsequence in a Directed Acyclic Graph written in Java

Read

https://scottjulian.com/finding-the-longest-common-subsequence/

Run Tests

./gradlew test

Example

Given Sequences:

abcde
bcaed
adbce

Output:

all pairs:
  (a b) (a c) (a d) (a e) (b c) (b d) (b e) (c d) (c e) (d e)
  (b c) (b a) (b e) (b d) (c a) (c e) (c d) (a e) (a d) (e d)
  (a d) (a b) (a c) (a e) (d b) (d c) (d e) (b c) (b e) (c e)

intersected pairs:
  (a d) (a e) (b c) (b e) (c e)

topological order of nodes:
  abdec

longest common subsequence:
  b c e