Liking cljdoc? Tell your friends :D

scicloj.zulipdata.graph

Graph-shaped views of the corpus, backed by JGraphT.

The two graphs we routinely care about:

  • channel co-membership — undirected weighted; nodes are channel names, edges weighted by number of shared users.
  • user co-presence — undirected weighted; nodes are anonymized user-keys, edges weighted by number of shared channels.

Plus utilities for community detection (Girvan-Newman, Label Propagation), betweenness centrality, and conversion to kind/cytoscape and kind/graphviz shapes.

Graph-shaped views of the corpus, backed by JGraphT.

The two graphs we routinely care about:

- **channel co-membership** — undirected weighted; nodes are
  channel names, edges weighted by number of shared users.
- **user co-presence** — undirected weighted; nodes are
  anonymized user-keys, edges weighted by number of shared
  channels.

Plus utilities for community detection (Girvan-Newman, Label
Propagation), betweenness centrality, and conversion to
`kind/cytoscape` and `kind/graphviz` shapes.
raw docstring

->cytoscape-elementsclj

(->cytoscape-elements g
                      &
                      {:keys [node-attrs edge-attrs]
                       :or {node-attrs (constantly {})
                            edge-attrs (constantly {})}})

Convert a JGraphT graph to a :elements map for kind/cytoscape. node-attrs and edge-attrs are optional fns of the node / [u v weight] returning a map of extra attributes (merged into :data).

Convert a JGraphT graph to a `:elements` map for `kind/cytoscape`.
`node-attrs` and `edge-attrs` are optional fns of the node /
[u v weight] returning a map of extra attributes (merged into
`:data`).
sourceraw docstring

->dotclj

(->dot g
       &
       {:keys [directed node-label edge-label name]
        :or
          {directed true node-label str edge-label (constantly nil) name "G"}})

Render a JGraphT graph as Graphviz DOT source. directed chooses between digraph/graph. node-label and edge-label are optional fns producing label strings.

Render a JGraphT graph as Graphviz DOT source. `directed` chooses
between `digraph`/`graph`. `node-label` and `edge-label` are
optional fns producing label strings.
sourceraw docstring

betweennessclj

(betweenness g)

Map node → betweenness centrality score.

Map node → betweenness centrality score.
sourceraw docstring

channel-comembership-graphclj

(channel-comembership-graph timeline & {:keys [min-shared] :or {min-shared 1}})

Undirected weighted graph: nodes are channels, edges weighted by shared user count. min-shared filters out edges with fewer than N shared users.

Undirected weighted graph: nodes are channels, edges weighted by
shared user count. `min-shared` filters out edges with fewer than
N shared users.
sourceraw docstring

girvan-newmanclj

(girvan-newman g k)

Vector of node-sets, one per cluster. k is the desired number of clusters.

Vector of node-sets, one per cluster. `k` is the desired number
of clusters.
sourceraw docstring

label-propagationclj

(label-propagation g)

Vector of node-sets — communities found by label propagation (number of clusters chosen by the algorithm).

Vector of node-sets — communities found by label propagation
(number of clusters chosen by the algorithm).
sourceraw docstring

migration-graphclj

(migration-graph timeline from-set & {:keys [min-users] :or {min-users 3}})

Directed weighted graph: edge from from-channel to to-channel weighted by the number of users who posted in from-channel and later (after their last post in any from-set channel) posted in to-channel. Excludes self-loops and edges within from-set.

Only users with at least 5 posts in from-set are considered.

Directed weighted graph: edge from `from-channel` to `to-channel`
weighted by the number of users who posted in `from-channel` and
*later* (after their last post in any `from-set` channel) posted
in `to-channel`. Excludes self-loops and edges within `from-set`.

Only users with at least 5 posts in `from-set` are considered.
sourceraw docstring

user-channel-setsclj

(user-channel-sets timeline)
(user-channel-sets timeline min-channels)

Map of user-key → set of channels they posted in. Drops users with fewer than min-channels channels (default 1).

Map of user-key → set of channels they posted in. Drops users with
fewer than `min-channels` channels (default 1).
sourceraw docstring

user-copresence-graphclj

(user-copresence-graph timeline
                       &
                       {:keys [min-shared min-channels]
                        :or {min-shared 3 min-channels 3}})

Undirected weighted graph: nodes are users, edges weighted by shared channel count. min-shared filters edges; min-channels filters users (active in ≥ N channels).

Undirected weighted graph: nodes are users, edges weighted by
shared channel count. `min-shared` filters edges; `min-channels`
filters users (active in ≥ N channels).
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close