There are the codes that we currently have:

names(codes)
##  [1] "AK1900"         "AL1852"         "AR1868"         "AR1874"        
##  [5] "AZ1865"         "AZ1887"         "CA1850"         "CA1851"        
##  [9] "CA1858"         "CA1868"         "CA1868extended" "CA1872"        
## [13] "CO1877"         "CT1854"         "CT1879"         "CT1879extended"
## [17] "DE1852"         "FL1870"         "GA1851"         "GA1860"        
## [21] "HI1859"         "HI1897"         "IA1839"         "IA1851"        
## [25] "ID1864"         "ID1881"         "IL1933"         "IN1843"        
## [29] "IN1852"         "KS1859"         "KY1851"         "LA1825"        
## [33] "MA1836"         "MA1858"         "MD1855"         "MD1859"        
## [37] "ME1840"         "MI1853"         "MN1851"         "MO1835"        
## [41] "MO1849"         "MO1856"         "MT1865"         "NC1868"        
## [45] "NE1866"         "NM1897"         "NV1861"         "NV1869"        
## [49] "NY1848"         "NY1849"         "NY1850"         "OH1853"        
## [53] "OH1853extended" "OK1891"         "OR1862"         "SC1870"        
## [57] "UT1853"         "UT1870"         "WA1855"         "WI1856"        
## [61] "WY1870"

Create the comparison matrix:

cf <- outer_for_lists(codes, codes, compare_codes_by_shared_ngrams)

Remove obviously incorrect values:

cf2  <- cf
diag(cf2) <- NA                 # remove codes compared to themselves
cf2 <- rm_anachronism(cf2)       # remove anachronistic comparisons

significance_threshold <- 0.03
cf2[cf2 < significance_threshold] <- NA
cf2[is.na(cf2)] <- 0

Now we can create a graph object from the comparison matrix, which we will treat as an adjacency matrix.

g <- graph.adjacency(cf2, mode = "directed", weighted = TRUE, diag = FALSE) 
set.seed(4821)
l <- layout.fruchterman.reingold(g, weights = E(g)$weight)
par(mar=c(0,0,1,0))
plot(g, edge.width = E(g)$weight * 10, layout = l,
     edge.arrow.size= 0.15, vertex.size = 5)
title("Codes of Civil Procedure")