# Les Miserables

URL: https://brege.org/post/les-miserables-graph-search/
Published: 2022-12-24
Updated: 2026-04-12
Tags: les-miserables, network-graphs, co-occurrence, vis.js, search, hugo
Categories: data-science

A network graph of character connections from one of my favorite books
and authors of all time, Victor Hugo's Les Miserables.

*Les Miserables is one of my favorite books.  I read most of the original translation on a train ride to Portland, OR from Chicago, IL back in 2008 and enjoyed the remainder on the return trip back East.  It taught me compassion: when Valjean places the coin in Cosette's shoe.  Father Christmas always misses her.  There was an earlier passage of a man stepping on a coin in front of her, while she swept dressed in rags.*

The graph may take a moment to load.

{{< lesmis-network nodesPath="data/nodes.json" edgesPath="data/edges.json" scriptPath="js/lesmis-network.js" >}}
{{< search-plots jsonPath="data/nodes.json" >}}

The search bar is the major addition to the graphing methods.
Nodes can be clicked and added to a subgraph builder.
You can continue to search for new node members in the search bar 
(which has a rudimentary autofill that's a straight json query)
and clicking on them will add them to the builder.
Simultaneously, the graph will reduce to a graph containing only 
all nodes with edges linked to nodes in the builder.

Items can be removed from the builder either by clicking the little builder tabs or re-clicking the node.  Clearing the builder bar completely will redraw the whole graph.

Testing and development was done on the mini pesto data set I made for [What is Pesto?](/post/what-is-pesto/).  Recipe builder coming soon(!)

Please email me at wyatt@brege.org with any questions. 

Dataset can be found here:

  - [`nodes.json`](data/nodes.json)
  - [`edges.json`](data/edges.json)


> Lingering annoyances:
>  - Slow
>  - Javascript needs clean up
>  - I have great fear running this on my 700x3000 dataset..