func’onal graphs in clojure · 2018. 6. 20. · graphs in clojure: complex graphs how to create...

73
& Func’onal Graphs in Clojure Aysylu Greenberg @aysylu22

Upload: others

Post on 17-Oct-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Func’onal Graphs in Clojure · 2018. 6. 20. · Graphs in Clojure: Complex Graphs How to create basic editable digraph? (defrecord BasicEditableDigraph [nodes succs preds]) (extend

&Func'onalGraphs

inClojure

AysyluGreenberg@aysylu22

Page 2: Func’onal Graphs in Clojure · 2018. 6. 20. · Graphs in Clojure: Complex Graphs How to create basic editable digraph? (defrecord BasicEditableDigraph [nodes succs preds]) (extend

AysyluGreenberg

@aysylu22

github.com/aysylu/loom

Page 3: Func’onal Graphs in Clojure · 2018. 6. 20. · Graphs in Clojure: Complex Graphs How to create basic editable digraph? (defrecord BasicEditableDigraph [nodes succs preds]) (extend

In this Talk

AMomentofGraphTheory GraphAPI

Design Func>onalGraph

AlgorithmsLoom

Overview

Page 4: Func’onal Graphs in Clojure · 2018. 6. 20. · Graphs in Clojure: Complex Graphs How to create basic editable digraph? (defrecord BasicEditableDigraph [nodes succs preds]) (extend

In this Talk

AMomentofGraphTheory GraphAPI

Design Func>onalGraph

AlgorithmsLoom

Overview

Page 5: Func’onal Graphs in Clojure · 2018. 6. 20. · Graphs in Clojure: Complex Graphs How to create basic editable digraph? (defrecord BasicEditableDigraph [nodes succs preds]) (extend

Graphs

Page 6: Func’onal Graphs in Clojure · 2018. 6. 20. · Graphs in Clojure: Complex Graphs How to create basic editable digraph? (defrecord BasicEditableDigraph [nodes succs preds]) (extend

GraphsinRealLife

Page 7: Func’onal Graphs in Clojure · 2018. 6. 20. · Graphs in Clojure: Complex Graphs How to create basic editable digraph? (defrecord BasicEditableDigraph [nodes succs preds]) (extend

TypesofGraphs

Simple Graph Weighted Graph

Page 8: Func’onal Graphs in Clojure · 2018. 6. 20. · Graphs in Clojure: Complex Graphs How to create basic editable digraph? (defrecord BasicEditableDigraph [nodes succs preds]) (extend

TypesofGraphs

Directed Graph (Digraph) Weighted Digraph

Page 9: Func’onal Graphs in Clojure · 2018. 6. 20. · Graphs in Clojure: Complex Graphs How to create basic editable digraph? (defrecord BasicEditableDigraph [nodes succs preds]) (extend

TypesofGraphs

Multigraph Mixed Graph

Page 10: Func’onal Graphs in Clojure · 2018. 6. 20. · Graphs in Clojure: Complex Graphs How to create basic editable digraph? (defrecord BasicEditableDigraph [nodes succs preds]) (extend

In this Talk

AMomentofGraphTheory GraphAPI

Design Func>onalGraph

AlgorithmsLoom

Overview

Page 11: Func’onal Graphs in Clojure · 2018. 6. 20. · Graphs in Clojure: Complex Graphs How to create basic editable digraph? (defrecord BasicEditableDigraph [nodes succs preds]) (extend

Graphs in OO World class Node { string data;}

class Edge { Node node1; Node node2;}

class Graph { List<Node> nodes; List<Edge> edges;}

Page 12: Func’onal Graphs in Clojure · 2018. 6. 20. · Graphs in Clojure: Complex Graphs How to create basic editable digraph? (defrecord BasicEditableDigraph [nodes succs preds]) (extend

Graph Representations

Page 13: Func’onal Graphs in Clojure · 2018. 6. 20. · Graphs in Clojure: Complex Graphs How to create basic editable digraph? (defrecord BasicEditableDigraph [nodes succs preds]) (extend

Graph Representations

•  AdjacencyList{A:[B],B:[C,D],C:[],…}

Page 14: Func’onal Graphs in Clojure · 2018. 6. 20. · Graphs in Clojure: Complex Graphs How to create basic editable digraph? (defrecord BasicEditableDigraph [nodes succs preds]) (extend

Graph Representations

•  AdjacencyList•  IncidenceList{A:[e1],B:[e2,e3],…,e1:[A,B],e2:[B,C],…}

Page 15: Func’onal Graphs in Clojure · 2018. 6. 20. · Graphs in Clojure: Complex Graphs How to create basic editable digraph? (defrecord BasicEditableDigraph [nodes succs preds]) (extend

Graph Representations

•  AdjacencyList•  IncidenceList•  AdjacencyMatrix

Source Des'na'on

A B … EA 0 1 … ∞B ∞ 0 … ∞… … … … …E ∞ 1 … 0

Page 16: Func’onal Graphs in Clojure · 2018. 6. 20. · Graphs in Clojure: Complex Graphs How to create basic editable digraph? (defrecord BasicEditableDigraph [nodes succs preds]) (extend

Graph Representations

•  AdjacencyList•  IncidenceList•  AdjacencyMatrix•  IncidenceMatrix

Nodes Edgese1 e2 .. e5

A S N … NB D S … D… … … … …E N N … S

Page 17: Func’onal Graphs in Clojure · 2018. 6. 20. · Graphs in Clojure: Complex Graphs How to create basic editable digraph? (defrecord BasicEditableDigraph [nodes succs preds]) (extend

Graph Representations

•  AdjacencyListsparsegraphs•  IncidenceList•  AdjacencyMatrixdensegraphs•  IncidenceMatrix

Page 18: Func’onal Graphs in Clojure · 2018. 6. 20. · Graphs in Clojure: Complex Graphs How to create basic editable digraph? (defrecord BasicEditableDigraph [nodes succs preds]) (extend

Graphs in FP World

•  Structs,interfaces&implementa>ons•  Flexiblerepresenta>on•  Immutablegraphs

Page 19: Func’onal Graphs in Clojure · 2018. 6. 20. · Graphs in Clojure: Complex Graphs How to create basic editable digraph? (defrecord BasicEditableDigraph [nodes succs preds]) (extend

Graphs in Clojure: Graph (defprotocol Graph (nodes [g]) (edges [g]) (has-node? [g node]) (has-edge? [g n1 n2]) (successors [g node]) (out-degree [g node]) (out-edges [g node]))

Page 20: Func’onal Graphs in Clojure · 2018. 6. 20. · Graphs in Clojure: Complex Graphs How to create basic editable digraph? (defrecord BasicEditableDigraph [nodes succs preds]) (extend

Graphs in Clojure: Digraph (defprotocol Digraph (predecessors [g node]) (in-degree [g node]) (in-edges [g node]) (transpose [g]))

Page 21: Func’onal Graphs in Clojure · 2018. 6. 20. · Graphs in Clojure: Complex Graphs How to create basic editable digraph? (defrecord BasicEditableDigraph [nodes succs preds]) (extend

Graphs in Clojure: WeightedGraph (defprotocol WeightedGraph (weight [g n1 n2]))

Page 22: Func’onal Graphs in Clojure · 2018. 6. 20. · Graphs in Clojure: Complex Graphs How to create basic editable digraph? (defrecord BasicEditableDigraph [nodes succs preds]) (extend

Graphs in Clojure: EditableGraph (defprotocol EditableGraph (add-nodes* [g nodes]) (add-edges* [g edges]) (remove-nodes* [g nodes]) (remove-edges* [g edges]) (remove-all [g]))

Page 23: Func’onal Graphs in Clojure · 2018. 6. 20. · Graphs in Clojure: Complex Graphs How to create basic editable digraph? (defrecord BasicEditableDigraph [nodes succs preds]) (extend

Graphs in Clojure: Complex Graphs

Howtocreatebasiceditabledigraph?(defrecord BasicEditableDigraph [nodes succs preds])

Page 24: Func’onal Graphs in Clojure · 2018. 6. 20. · Graphs in Clojure: Complex Graphs How to create basic editable digraph? (defrecord BasicEditableDigraph [nodes succs preds]) (extend

Graphs in Clojure: Complex Graphs

Howtocreatebasiceditabledigraph?(defrecord BasicEditableDigraph [nodes succs preds])(extend BasicEditableDigraph Graph … Digraph … EditableGraph …)

Page 25: Func’onal Graphs in Clojure · 2018. 6. 20. · Graphs in Clojure: Complex Graphs How to create basic editable digraph? (defrecord BasicEditableDigraph [nodes succs preds]) (extend

Graphs in Clojure: Complex Graphs

Howtocreatebasiceditabledigraph?(defrecord BasicEditableDigraph [nodes succs preds])(extend BasicEditableDigraph Graph

)

(nodes [g])(edges [g])(has-node? [g node])(has-edge? [g n1 n2])(successors [g] [g node])(out-degree [g node])

Protocoldefini>on(notvalidcode!)

Page 26: Func’onal Graphs in Clojure · 2018. 6. 20. · Graphs in Clojure: Complex Graphs How to create basic editable digraph? (defrecord BasicEditableDigraph [nodes succs preds]) (extend

Graphs in Clojure: Complex Graphs

Howtocreatebasiceditabledigraph?(defrecord BasicEditableDigraph [nodes succs preds])(extend BasicEditableDigraph Graph default-graph-impl Digraph … EditableGraph …)

Page 27: Func’onal Graphs in Clojure · 2018. 6. 20. · Graphs in Clojure: Complex Graphs How to create basic editable digraph? (defrecord BasicEditableDigraph [nodes succs preds]) (extend

Graphs in Clojure: Complex Graphs (def default-graph-impl {:edges (fn [g] (for [n1 (nodes g) e (out-edges g n1)] e)) :nodes (fn [g] ...) ...})

(nodes [g])(edges [g])(has-node? [g node])(has-edge? [g n1 n2])(successors [g] [g node])(out-degree [g node])

Page 28: Func’onal Graphs in Clojure · 2018. 6. 20. · Graphs in Clojure: Complex Graphs How to create basic editable digraph? (defrecord BasicEditableDigraph [nodes succs preds]) (extend

Graphs in Clojure: Complex Graphs

Howtocreatebasiceditabledigraph?(defrecord BasicEditableDigraph [nodes succs preds])(extend BasicEditableDigraph Graph default-graph-impl Digraph … EditableGraph …)

Page 29: Func’onal Graphs in Clojure · 2018. 6. 20. · Graphs in Clojure: Complex Graphs How to create basic editable digraph? (defrecord BasicEditableDigraph [nodes succs preds]) (extend

Graphs in Clojure: Complex Graphs

Howtocreatebasiceditabledigraph?(defrecord BasicEditableDigraph [nodes succs preds])(extend BasicEditableDigraph Graph default-graph-impl Digraph default-digraph-impl EditableGraph …)

Page 30: Func’onal Graphs in Clojure · 2018. 6. 20. · Graphs in Clojure: Complex Graphs How to create basic editable digraph? (defrecord BasicEditableDigraph [nodes succs preds]) (extend

Graphs in Clojure: Complex Graphs

(def default-digraph-impl {:transpose (fn [g] (assoc g :succs (:preds g) :preds (:succs g))) …}) (predecessors [g]

[g node])(in-degree [g node])(transpose [g])

Page 31: Func’onal Graphs in Clojure · 2018. 6. 20. · Graphs in Clojure: Complex Graphs How to create basic editable digraph? (defrecord BasicEditableDigraph [nodes succs preds]) (extend

Graphs in Clojure: Complex Graphs

Howtocreatebasiceditabledigraph?(defrecord BasicEditableDigraph [nodes succs preds])(extend BasicEditableDigraph Graph default-graph-impl Digraph default-digraph-impl EditableGraph …)

Page 32: Func’onal Graphs in Clojure · 2018. 6. 20. · Graphs in Clojure: Complex Graphs How to create basic editable digraph? (defrecord BasicEditableDigraph [nodes succs preds]) (extend

Graphs in Clojure: Complex Graphs

Howtocreatebasiceditabledigraph?(defrecord BasicEditableDigraph [nodes succs preds])(extend BasicEditableDigraph Graph default-graph-impl Digraph default-digraph-impl EditableGraph editable-graph-impl)

Page 33: Func’onal Graphs in Clojure · 2018. 6. 20. · Graphs in Clojure: Complex Graphs How to create basic editable digraph? (defrecord BasicEditableDigraph [nodes succs preds]) (extend

Graphs in FP World

•  Structs,interfaces&implementa>ons•  Flexiblerepresenta>on•  Immutablegraphs

Page 34: Func’onal Graphs in Clojure · 2018. 6. 20. · Graphs in Clojure: Complex Graphs How to create basic editable digraph? (defrecord BasicEditableDigraph [nodes succs preds]) (extend

In this Talk

AMomentofGraphTheory GraphAPI

Design Func>onalGraph

AlgorithmsLoom

Overview

Page 35: Func’onal Graphs in Clojure · 2018. 6. 20. · Graphs in Clojure: Complex Graphs How to create basic editable digraph? (defrecord BasicEditableDigraph [nodes succs preds]) (extend

Functional Graph Algorithms: Bellman-Ford

Page 36: Func’onal Graphs in Clojure · 2018. 6. 20. · Graphs in Clojure: Complex Graphs How to create basic editable digraph? (defrecord BasicEditableDigraph [nodes succs preds]) (extend

Functional Graph Algorithms: Bellman-Ford

CLRS Introduction to Algorithms

Page 37: Func’onal Graphs in Clojure · 2018. 6. 20. · Graphs in Clojure: Complex Graphs How to create basic editable digraph? (defrecord BasicEditableDigraph [nodes succs preds]) (extend

Functional Graph Algorithms: Bellman-Ford

CLRS Introduction to Algorithms

Page 38: Func’onal Graphs in Clojure · 2018. 6. 20. · Graphs in Clojure: Complex Graphs How to create basic editable digraph? (defrecord BasicEditableDigraph [nodes succs preds]) (extend

Functional Graph Algorithms: Bellman-Ford

(defn- init-estimates [graph start] (let [nodes (disj (nodes graph) start) costs (interleave nodes(repeat ∞)) paths (interleave nodes (repeat nil))] [(apply assoc {start 0} costs) (apply assoc {start nil} paths)]))

Page 39: Func’onal Graphs in Clojure · 2018. 6. 20. · Graphs in Clojure: Complex Graphs How to create basic editable digraph? (defrecord BasicEditableDigraph [nodes succs preds]) (extend

Functional Graph Algorithms: Bellman-Ford

Page 40: Func’onal Graphs in Clojure · 2018. 6. 20. · Graphs in Clojure: Complex Graphs How to create basic editable digraph? (defrecord BasicEditableDigraph [nodes succs preds]) (extend

Functional Graph Algorithms: Bellman-Ford

Page 41: Func’onal Graphs in Clojure · 2018. 6. 20. · Graphs in Clojure: Complex Graphs How to create basic editable digraph? (defrecord BasicEditableDigraph [nodes succs preds]) (extend

Functional Graph Algorithms: Bellman-Ford

(defn- can-relax-edge? [[u v :as edge] edge-cost costs] (let [vd (get costs v) ud (get costs u) sum (+ ud edge-cost)] (> vd sum)))

Page 42: Func’onal Graphs in Clojure · 2018. 6. 20. · Graphs in Clojure: Complex Graphs How to create basic editable digraph? (defrecord BasicEditableDigraph [nodes succs preds]) (extend

Functional Graph Algorithms: Bellman-Ford

(defn- relax-edge [[u v :as edge] uvcost [costs paths :as estimates]] (let [ud (get costs u) sum (+ ud uvcost)] (if (can-relax-edge? edge uvcost costs) [(assoc costs v sum) (assoc paths v u)] estimates)))

Page 43: Func’onal Graphs in Clojure · 2018. 6. 20. · Graphs in Clojure: Complex Graphs How to create basic editable digraph? (defrecord BasicEditableDigraph [nodes succs preds]) (extend

Functional Graph Algorithms: Bellman-Ford

Page 44: Func’onal Graphs in Clojure · 2018. 6. 20. · Graphs in Clojure: Complex Graphs How to create basic editable digraph? (defrecord BasicEditableDigraph [nodes succs preds]) (extend

Functional Graph Algorithms: Bellman-Ford

(defn- relax-edges [g start estimates] (reduce (fn [estimates [u v :as edge]] (relax-edge edge (weight g u v)

estimates)) estimates (edges g)))

Page 45: Func’onal Graphs in Clojure · 2018. 6. 20. · Graphs in Clojure: Complex Graphs How to create basic editable digraph? (defrecord BasicEditableDigraph [nodes succs preds]) (extend

Functional Graph Algorithms: Bellman-Ford

(defn bellman-ford [g start]

(let [initial-estimates (init-estimates g start) ;relax-edges is calculated for all edges V-1 times

[costs paths] (reduce (fn [estimates _] (relax-edges g start estimates)) initial-estimates

(-> g nodes count dec range)) edges (edges g)]

(if (some (fn [[u v :as edge]] (can-relax-edge? edge (wt g u v) costs)) edges)

false [costs

(->> (keys paths) ;remove vertices that are unreachable from source

(remove #(= Double/POSITIVE_INFINITY (get costs %))) (reduce

(fn [final-paths v] (assoc final-paths v

; follows the parent pointers ; to construct path from source to node v

(loop [node v path ()]

(if node (recur (get paths node) (cons node path))

path)))) {}))])))

Page 46: Func’onal Graphs in Clojure · 2018. 6. 20. · Graphs in Clojure: Complex Graphs How to create basic editable digraph? (defrecord BasicEditableDigraph [nodes succs preds]) (extend
Page 47: Func’onal Graphs in Clojure · 2018. 6. 20. · Graphs in Clojure: Complex Graphs How to create basic editable digraph? (defrecord BasicEditableDigraph [nodes succs preds]) (extend

•  Func>oncomposi>on•  Func>onsoperateonhelperdatastructures•  Higherorderfunc>ons•  reducetoiterateoverelements

Page 48: Func’onal Graphs in Clojure · 2018. 6. 20. · Graphs in Clojure: Complex Graphs How to create basic editable digraph? (defrecord BasicEditableDigraph [nodes succs preds]) (extend
Page 49: Func’onal Graphs in Clojure · 2018. 6. 20. · Graphs in Clojure: Complex Graphs How to create basic editable digraph? (defrecord BasicEditableDigraph [nodes succs preds]) (extend

Functional Graph Algorithms: Bellman-Ford

(defn bellman-ford [g start] (let [initial-estimates (init-estimates g start) ;relax-edges is calculated for all edges V-1 times [costs paths] (reduce (fn [estimates _] (relax-edges g start estimates)) initial-estimates (-> g nodes count dec range)) edges (edges g)]

Page 50: Func’onal Graphs in Clojure · 2018. 6. 20. · Graphs in Clojure: Complex Graphs How to create basic editable digraph? (defrecord BasicEditableDigraph [nodes succs preds]) (extend

Functional Graph Algorithms: Bellman-Ford

(if (some (fn [[u v :as edge]] (can-relax-edge? edge

(weight g u v) costs))

edges) false

;;; return paths)))

Page 51: Func’onal Graphs in Clojure · 2018. 6. 20. · Graphs in Clojure: Complex Graphs How to create basic editable digraph? (defrecord BasicEditableDigraph [nodes succs preds]) (extend

Functional Graph Algorithms

•  Everythingisafunc>on•  Func>onsoninternalrepresenta>on•  Everyfunc>onreturnsnewrepresenta>on

Page 52: Func’onal Graphs in Clojure · 2018. 6. 20. · Graphs in Clojure: Complex Graphs How to create basic editable digraph? (defrecord BasicEditableDigraph [nodes succs preds]) (extend

In this Talk

AMomentofGraphTheory GraphAPI

Design Func>onalGraph

AlgorithmsLoom

Overview

Page 53: Func’onal Graphs in Clojure · 2018. 6. 20. · Graphs in Clojure: Complex Graphs How to create basic editable digraph? (defrecord BasicEditableDigraph [nodes succs preds]) (extend

GraphAlgorithms+Visualiza>on

github.com/aysylu/loom

Page 54: Func’onal Graphs in Clojure · 2018. 6. 20. · Graphs in Clojure: Complex Graphs How to create basic editable digraph? (defrecord BasicEditableDigraph [nodes succs preds]) (extend

Loom Overview: Supported Graphs

•  UndirectedGraph•  Digraph•  WeightedGraph

•  Mul>graph

•  FlyGraph•  nodes+successorsedges

•  successors+startnodes+edges

Page 55: Func’onal Graphs in Clojure · 2018. 6. 20. · Graphs in Clojure: Complex Graphs How to create basic editable digraph? (defrecord BasicEditableDigraph [nodes succs preds]) (extend

Loom Overview: Graph Algorithms

•  DFS/BFS(+bidirec>onal)

Page 56: Func’onal Graphs in Clojure · 2018. 6. 20. · Graphs in Clojure: Complex Graphs How to create basic editable digraph? (defrecord BasicEditableDigraph [nodes succs preds]) (extend

Loom Overview: Graph Algorithms

•  DFS/BFS(+bidirec>onal)•  TopologicalSort

Page 57: Func’onal Graphs in Clojure · 2018. 6. 20. · Graphs in Clojure: Complex Graphs How to create basic editable digraph? (defrecord BasicEditableDigraph [nodes succs preds]) (extend

Loom Overview: Graph Algorithms

•  DFS/BFS(+bidirec>onal)•  TopologicalSort•  ShortestPath(Dijkstra,Bellman-Ford,A*,Johnson’s)

Page 58: Func’onal Graphs in Clojure · 2018. 6. 20. · Graphs in Clojure: Complex Graphs How to create basic editable digraph? (defrecord BasicEditableDigraph [nodes succs preds]) (extend

Loom Overview: Graph Algorithms

•  DFS/BFS(+bidirec>onal)•  TopologicalSort•  ShortestPath(Dijkstra,Bellman-Ford,A*,Johnson’s)

•  Cliques&SCC(Bron-Kerbosch,Kosaraju)

Page 59: Func’onal Graphs in Clojure · 2018. 6. 20. · Graphs in Clojure: Complex Graphs How to create basic editable digraph? (defrecord BasicEditableDigraph [nodes succs preds]) (extend

Loom Overview: Graph Algorithms

•  DFS/BFS(+bidirec>onal)•  TopologicalSort•  ShortestPath(Dijkstra,Bellman-Ford,A*,Johnson’s)

•  Cliques&SCC(Bron-Kerbosch,Kosaraju)•  Density(edges/nodes)•  LonerNodes

Page 60: Func’onal Graphs in Clojure · 2018. 6. 20. · Graphs in Clojure: Complex Graphs How to create basic editable digraph? (defrecord BasicEditableDigraph [nodes succs preds]) (extend

Loom Overview: Graph Algorithms

•  DFS/BFS(+bidirec>onal)•  TopologicalSort•  ShortestPath(Dijkstra,Bellman-Ford,A*,Johnson’s)

•  Cliques&SCC(Bron-Kerbosch,Kosaraju)•  Density(edges/nodes)•  LonerNodes•  Greedy&TwoColoring

Page 61: Func’onal Graphs in Clojure · 2018. 6. 20. · Graphs in Clojure: Complex Graphs How to create basic editable digraph? (defrecord BasicEditableDigraph [nodes succs preds]) (extend

Loom Overview: Graph Algorithms

•  DFS/BFS(+bidirec>onal)•  TopologicalSort•  ShortestPath(Dijkstra,Bellman-Ford,A*,Johnson’s)

•  Cliques&SCC(Bron-Kerbosch,Kosaraju)•  Density(edges/nodes)•  LonerNodes•  Greedy&TwoColoring•  Max-Flow(Edmonds-Karp)

Page 62: Func’onal Graphs in Clojure · 2018. 6. 20. · Graphs in Clojure: Complex Graphs How to create basic editable digraph? (defrecord BasicEditableDigraph [nodes succs preds]) (extend

Functional Graph Algorithms: loom.alg-generic

•  Noknowledgeofgraphrepresenta>on•  Requiresonlysuccessors

+startforDFS/BFS,topologicalsort,Dijkstra+endforBFSpath

Page 63: Func’onal Graphs in Clojure · 2018. 6. 20. · Graphs in Clojure: Complex Graphs How to create basic editable digraph? (defrecord BasicEditableDigraph [nodes succs preds]) (extend

Loom Overview: Visualizing Graphs

Page 64: Func’onal Graphs in Clojure · 2018. 6. 20. · Graphs in Clojure: Complex Graphs How to create basic editable digraph? (defrecord BasicEditableDigraph [nodes succs preds]) (extend
Page 65: Func’onal Graphs in Clojure · 2018. 6. 20. · Graphs in Clojure: Complex Graphs How to create basic editable digraph? (defrecord BasicEditableDigraph [nodes succs preds]) (extend

WRAPUP:FUNCTIONALGRAPHS

Page 66: Func’onal Graphs in Clojure · 2018. 6. 20. · Graphs in Clojure: Complex Graphs How to create basic editable digraph? (defrecord BasicEditableDigraph [nodes succs preds]) (extend

Func>onalDataStructures

Page 67: Func’onal Graphs in Clojure · 2018. 6. 20. · Graphs in Clojure: Complex Graphs How to create basic editable digraph? (defrecord BasicEditableDigraph [nodes succs preds]) (extend

DATA&FUNCTIONSSEPARATEDTakeaway#1

Page 68: Func’onal Graphs in Clojure · 2018. 6. 20. · Graphs in Clojure: Complex Graphs How to create basic editable digraph? (defrecord BasicEditableDigraph [nodes succs preds]) (extend

FLEXIBLEREPRESENTATIONTakeaway#2

Page 69: Func’onal Graphs in Clojure · 2018. 6. 20. · Graphs in Clojure: Complex Graphs How to create basic editable digraph? (defrecord BasicEditableDigraph [nodes succs preds]) (extend

IMMUTABLEGRAPHSTakeaway#3

Page 70: Func’onal Graphs in Clojure · 2018. 6. 20. · Graphs in Clojure: Complex Graphs How to create basic editable digraph? (defrecord BasicEditableDigraph [nodes succs preds]) (extend

USELOOMTakeaway#4

Page 71: Func’onal Graphs in Clojure · 2018. 6. 20. · Graphs in Clojure: Complex Graphs How to create basic editable digraph? (defrecord BasicEditableDigraph [nodes succs preds]) (extend

https://adambard.com/blog/building-a-suggestion-engine-for-redditlater/

Page 72: Func’onal Graphs in Clojure · 2018. 6. 20. · Graphs in Clojure: Complex Graphs How to create basic editable digraph? (defrecord BasicEditableDigraph [nodes succs preds]) (extend

ThankstoLoomcontributors•  JohnSzakmeister•  RobertLachlan•  StephenKocken>edt•  AlexEngelberg•  KevinDowney•  AaronBrooks•  MarkEngelberg•  DanielShapero•  DanielGregoire•  TomHancock•  HorstDuchêne•  AshtonKemerling•  Jus>nKramer

•  JonyHudson•  GuruDevanla•  JoshuaDavey•  SungPae•  FrançoisRey•  GeorgiShopov•  MaqRevelle•  ZackMaril•  DanielCompton•  ReidDMcKenzie•  ZTO•  AysyluGreenberg•  PaulSnyder

Page 73: Func’onal Graphs in Clojure · 2018. 6. 20. · Graphs in Clojure: Complex Graphs How to create basic editable digraph? (defrecord BasicEditableDigraph [nodes succs preds]) (extend

&Func'onalGraphs

inClojure

AysyluGreenberg@aysylu22