lib.bend checks
raw source on the hub · import 0x87443356945470112b78ad5f17a0cfb9/lib.bend as Lib
Graph — foundational simple directed graph for Bend. Consumer import entry (publish via seal.bend). Depends only on Base.
Nodes are U32 values. Edges are unique ordered pairs. add_edge adds both endpoints if needed; nodes preserve insertion order and neighbors preserve edge order.
1 import
import Base
Types
type Edge source · line 8 · raw
Data
E@from:U32 -> @to:U32 -> Edge
type Graph source · line 11 · raw
Data
G@nodes:List<&2, U32> -> @edges:List<&2, Edge> -> Graph
Definitions
def Graph.empty source · line 14 · raw
Graph
def Graph.add_node.go source · line 17 · raw
@ns:List<&2, U32> -> @es:List<&2, Edge> -> @x:U32 -> @present:Bool -> Graph
def Graph.add_node source · line 24 · raw
@g:Graph -> @+x:U32 -> Graph
def Graph.edge_eq source · line 29 · raw
@from:U32 -> @to:U32 -> @e:Edge -> Bool
def Graph.has_edge.go source · line 34 · raw
@+from:U32 -> @+to:U32 -> @es:List<&2, Edge> -> Bool
def Graph.has_edge source · line 41 · raw
@g:Graph -> @from:U32 -> @to:U32 -> Bool
def Graph.add_edge.go source · line 46 · raw
@ns:List<&2, U32> -> @es:List<&2, Edge> -> @from:U32 -> @to:U32 -> @present:Bool -> Graph
def Graph.add_edge.if source · line 53 · raw
@g:Graph -> @+from:U32 -> @+to:U32 -> Graph
def Graph.add_edge source · line 58 · raw
@g:Graph -> @+from:U32 -> @+to:U32 -> Graph
def Graph.neighbors.go source · line 61 · raw
@+from:U32 -> @es:List<&2, Edge> -> List<&2, U32>
def Graph.neighbors source · line 72 · raw
@g:Graph -> @from:U32 -> List<&2, U32>
def Graph.nodes source · line 77 · raw
@g:Graph -> List<&2, U32>
def Graph.edge_count source · line 82 · raw
@g:Graph -> Nat