aonyx/graph/node
Types
Represents a node in the graph identified by a key and containing an optional value.
pub type Node(key, value) {
Node(
key: key,
value: option.Option(value),
outgoing: set.Set(key),
incoming: set.Set(key),
)
}
Constructors
-
Node( key: key, value: option.Option(value), outgoing: set.Set(key), incoming: set.Set(key), )
Values
pub fn get_neighbors(node: Node(a, b)) -> Set(a)
Returns a set union of keys of all direct neighbors of a given node in both directions.
pub fn get_neighbors_in(node: Node(a, b)) -> Set(a)
Returns a set of keys of all direct neighbors of a given node via incoming edges.
pub fn get_neighbors_out(node: Node(a, b)) -> Set(a)
Returns a set of keys of all direct neighbors of a given node via outgoing edges.
pub fn with_incoming(
node: Node(a, b),
incoming: List(a),
) -> Node(a, b)
Sets the incoming edges of a node.
pub fn with_outgoing(
node: Node(a, b),
outgoing: List(a),
) -> Node(a, b)
Sets the outgoing edges of a node.
pub fn with_value(node: Node(a, b), value: b) -> Node(a, b)
Sets the value of a node.