Liking cljdoc? Tell your friends :D

loom.graph

Defines protocols for graphs, digraphs, and weighted graphs. Also provides record implementations and constructors for simple graphs -- weighted, unweighted, directed, and undirected. The implementations are based on adjacency lists.

Defines protocols for graphs, digraphs, and weighted graphs.
Also provides record implementations and constructors for simple graphs --
weighted, unweighted, directed, and undirected. The implementations are based
on adjacency lists.
raw docstring

*default-weight*clj/s

Weight used when none is given for edges in weighted graphs

Weight used when none is given for edges in weighted graphs
sourceraw docstring

add-cycleclj/s

(add-cycle g & nodes)

Adds a cycle of edges connecting the given nodes in order

Adds a cycle of edges connecting the given nodes in order
sourceraw docstring

add-edgesclj/s

(add-edges g & edges)

Adds edges to graph g. For unweighted graphs, edges take the form [n1 n2]. For weighted graphs, edges take the form [n1 n2 weight] or [n1 n2], the latter defaulting to a weight of 1

Adds edges to graph g. For unweighted graphs, edges take the form [n1 n2].
For weighted graphs, edges take the form [n1 n2 weight] or [n1 n2], the
latter defaulting to a weight of 1
sourceraw docstring

add-nodesclj/s

(add-nodes g & nodes)

Adds nodes to graph g. Nodes can be any type of object

Adds nodes to graph g. Nodes can be any type of object
sourceraw docstring

add-pathclj/s

(add-path g & nodes)

Adds a path of edges connecting the given nodes in order

Adds a path of edges connecting the given nodes in order
sourceraw docstring

BasicEditableDigraphclj/s

source

BasicEditableGraphclj/s

source

BasicEditableWeightedDigraphclj/s

source

BasicEditableWeightedGraphclj/s

source

build-graphclj/s

(build-graph g & inits)

Builds up a graph (i.e. adds edges and nodes) from any combination of other graphs, adjacency maps, edges, or nodes.

Builds up a graph (i.e. adds edges and nodes) from any combination of
other graphs, adjacency maps, edges, or nodes.
sourceraw docstring

default-digraph-implclj

source

default-graph-implsclj

source

default-weighted-graph-implclj

source

Digraphclj/sprotocol

in-degreeclj/s

(in-degree g node)

Returns the number of direct predecessors to node

Returns the number of direct predecessors to node

in-edgesclj/s

(in-edges g node)

Returns all the incoming edges of node

Returns all the incoming edges of node

predecessors*clj/s

(predecessors* g node)

Returns direct predecessors of node

Returns direct predecessors of node

transposeclj/s

(transpose g)

Returns a graph with all edges reversed

Returns a graph with all edges reversed
source

digraphclj/s

(digraph & inits)

Creates an unweighted, directed graph. inits can be edges, adjacency maps, or graphs

Creates an unweighted, directed graph. inits can be edges, adjacency maps,
or graphs
sourceraw docstring

directed?clj/s

(directed? g)

Returns true if g satisfies the Digraph protocol

Returns true if g satisfies the Digraph protocol
sourceraw docstring

Edgeclj/sprotocol

destclj/s

(dest edge)

Returns the dest node of the edge

Returns the dest node of the edge

srcclj/s

(src edge)

Returns the source node of the edge

Returns the source node of the edge
source

editable?clj/s

(editable? g)

Returns true if g satisfies the EditableGraph protocol

Returns true if g satisfies the EditableGraph protocol
sourceraw docstring

EditableGraphclj/sprotocol

add-edges*clj/s

(add-edges* g edges)

Add edges to graph g. See add-edges

Add edges to graph g. See add-edges

add-nodes*clj/s

(add-nodes* g nodes)

Add nodes to graph g. See add-nodes

Add nodes to graph g. See add-nodes

remove-allclj/s

(remove-all g)

Removes all nodes and edges from graph g

Removes all nodes and edges from graph g

remove-edges*clj/s

(remove-edges* g edges)

Removes edges from graph g. See remove-edges

Removes edges from graph g. See remove-edges

remove-nodes*clj/s

(remove-nodes* g nodes)

Remove nodes from graph g. See remove-nodes

Remove nodes from graph g. See remove-nodes
source

fly-graphclj/s

(fly-graph & {:keys [nodes edges successors predecessors weight start]})

Creates a read-only, ad-hoc graph which uses the provided functions to return values for nodes, edges, etc. If any members are not functions, they will be returned as-is. Edges can be inferred if nodes and successors are provided. Nodes and edges can be inferred if successors and start are provided.

Creates a read-only, ad-hoc graph which uses the provided functions
to return values for nodes, edges, etc. If any members are not functions,
they will be returned as-is. Edges can be inferred if nodes and
successors are provided. Nodes and edges can be inferred if successors and
start are provided.
sourceraw docstring

FlyDigraphclj/s

source

FlyGraphclj/s

source

graphclj/s

(graph & inits)

Creates an unweighted, undirected graph. inits can be edges, adjacency maps, or graphs

Creates an unweighted, undirected graph. inits can be edges, adjacency maps,
or graphs
sourceraw docstring

Graphclj/sprotocol

edgesclj/s

(edges g)

Edges in g. May return each edge twice in an undirected graph

Edges in g. May return each edge twice in an undirected graph

has-edge?clj/s

(has-edge? g n1 n2)

Returns true when edge [n1 n2] is in g

Returns true when edge [n1 n2] is in g

has-node?clj/s

(has-node? g node)

Returns true when node is in g

Returns true when node is in g

nodesclj/s

(nodes g)

Returns a collection of the nodes in graph g

Returns a collection of the nodes in graph g

out-degreeclj/s

(out-degree g node)

Returns the number of outgoing edges of node

Returns the number of outgoing edges of node

out-edgesclj/s

(out-edges g node)

Returns all the outgoing edges of node

Returns all the outgoing edges of node

successors*clj/s

(successors* g node)

Returns direct successors of node

Returns direct successors of node
source

graph?clj/s

(graph? g)

Returns true if g satisfies the Graph protocol

Returns true if g satisfies the Graph protocol
sourceraw docstring

predecessorsclj/s

(predecessors g)
(predecessors g node)

Returns direct predecessors of node

Returns direct predecessors of node
sourceraw docstring

remove-edgesclj/s

(remove-edges g & edges)

Removes edges from graph g. Do not include weights

Removes edges from graph g. Do not include weights
sourceraw docstring

remove-nodesclj/s

(remove-nodes g & nodes)

Removes nodes from graph g

Removes nodes from graph g
sourceraw docstring

subgraphclj/s

(subgraph g ns)

Returns a graph with only the given nodes

Returns a graph with only the given nodes
sourceraw docstring

successorsclj/s

(successors g)
(successors g node)

Returns direct successors of node

Returns direct successors of node
sourceraw docstring

weightclj/s

(weight g)
(weight g e)
(weight g n1 n2)

Returns the weight of edge e or edge [n1 n2]

Returns the weight of edge e or edge [n1 n2]
sourceraw docstring

weighted-digraphclj/s

(weighted-digraph & inits)

Creates an weighted, directed graph. inits can be edges, adjacency maps, or graphs

Creates an weighted, directed graph. inits can be edges, adjacency maps,
or graphs
sourceraw docstring

weighted-graphclj/s

(weighted-graph & inits)

Creates an weighted, undirected graph. inits can be edges, adjacency maps, or graphs

Creates an weighted, undirected graph. inits can be edges, adjacency maps,
or graphs
sourceraw docstring

weighted?clj/s

(weighted? g)

Returns true if g satisfies the WeightedGraph protocol

Returns true if g satisfies the WeightedGraph protocol
sourceraw docstring

WeightedFlyDigraphclj/s

source

WeightedFlyGraphclj/s

source

WeightedGraphclj/sprotocol

weight*clj/s

(weight* g e)
(weight* g n1 n2)

Returns the weight of edge e or edge [n1 n2]

Returns the weight of edge e or edge [n1 n2]
source

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

× close