Gspan is an algorithm for frequent subgraph mining that avoids two major costs of previous approaches. It represents graphs as depth-first search (DFS) codes to compare graphs for isomorphism testing. The algorithm grows patterns by extending edges in lexicographic order, checking the anti-monotonic property to prune infrequent subgraphs. Gspan compares the minimum DFS codes of two graphs to determine isomorphism, allowing simple string comparison of graphs. This helps reduce the problem size versus subgraph isomorphism testing.