# Algorithm to convert many instances of unidirectional lists to a graph?

I feel like I’m missing something basic.

I have instances of a list compromising of unique graph nodes / elements visited. Lists happen in order, but follow graph based rules (can be cyclical, only some connections are allowed, there are optional nodes in a graph, some nodes always happen in unison, etc). How can I derive the graph represented by billions of instances of these lists? And maybe even sub-graphs nested within?

``````e.g. list instance #1: A -> B -> D -> E
e.g. list instance #2: A -> F -> K
e.g. list instance #3: A-> B-> K > B -> D -> E
``````

e.g. graph vertices derived from these lists:

``````A -> B
B -> D
B -> K
D -> E
F -> K
``````

This feels like a solved compsci problem that I’m trying rearticulate. Like, I get that I can always calculate the vertices (either by weight / likelihood to occur, or as booleans if they occurred). But that feels like I’m missing a lot of nested complexity and trying to reinvent the wheel. Is there an esteblished approach to this problem?