Liking cljdoc? Tell your friends :D

digraph.core

Directed graph operations and specifications.

Directed graph operations and specifications.
raw docstring

adj-edgesclj

(adj-edges graph v)

Returns the set of all edges that v is adjacent to, meaning all edges that originate from v.

Returns the set of all edges that v is adjacent to, meaning
all edges that originate from v.
sourceraw docstring

adj?clj

(adj? graph x y)

Returns true if x is adjacent to y in the given graph, where adjacent is defined as the existence of an edge originating from x and terminating at y.

Returns true if x is adjacent to y in the given graph, where
adjacent is defined as the existence of an edge originating
from x and terminating at y.
sourceraw docstring

cyclic?clj

(cyclic? graph)

Returns true if the given graph contains a cycle, false otherwise.

Returns true if the given graph contains a cycle, false otherwise.
sourceraw docstring

digraph-genclj

(digraph-gen)

Generator for digraphs.

Generator for digraphs.
sourceraw docstring

indegreeclj

(indegree graph v)

Returns the indegree of the given node, where indegree is defined as the number of edges that terminate at a given node. Returns nil if the given node is not present in the graph.

Returns the indegree of the given node, where indegree
is defined as the number of edges that terminate at a given
node. Returns nil if the given node is not present in the
graph.
sourceraw docstring

internal?clj

(internal? graph v)

Returns true if the given node is internal, where internal is defined as having a non-zero indegree and outdegree.

Returns true if the given node is internal, where
internal is defined as having a non-zero indegree and outdegree.
sourceraw docstring

make-digraphclj

(make-digraph node-set & edges)

Constructs a new directed graph.

Constructs a new directed graph.
sourceraw docstring

outdegreeclj

(outdegree graph v)

Returns the outdegree of the given node, where outdegree is defined as the number of edges that originate from a given node. Returns nil if the given node is not present in the graph.

Returns the outdegree of the given node, where outdegree
is defined as the number of edges that originate from a given
node. Returns nil if the given node is not present in the
graph.
sourceraw docstring

sink?clj

(sink? graph v)

Returns true if the given node is a sink, where sink is defined as having an outdegree count of zero, and a non-zero indegree count.

Returns true if the given node is a sink, where sink
is defined as having an outdegree count of zero, and a
non-zero indegree count.
sourceraw docstring

source?clj

(source? graph v)

Returns true if the given node is a source, where source is defined as having an indegree count of zero, and a non-zero outdegree count.

Returns true if the given node is a source, where source
is defined as having an indegree count of zero, and a non-zero
outdegree count.
sourceraw docstring

stranded?clj

(stranded? graph v)

Returns true if the given node is stranded, meaning that both its indegree and outdegree are zero.

Returns true if the given node is stranded, meaning that
both its indegree and outdegree are zero.
sourceraw docstring

topological-sortclj

(topological-sort {:keys [nodes] :as graph})

Returns a vector of the given graph's nodes in topological order, or nil if the graph can not be sorted (e.g. it contains a cycle). Uses Kahn's algorithm to compute the sort.

Returns a vector of the given graph's nodes in topological order,
or nil if the graph can not be sorted (e.g. it contains a cycle).
Uses Kahn's algorithm to compute the sort.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close