Public
Edited
Jan 16, 2023
Insert cell
Insert cell
Insert cell
sc = require("sourcecred@latest")
// In other environments, you might need to use:
// sc = require("sourcecred").sourcecred
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
createIdentityProposals = ({ pluginName, participants }) => (
participants.map((participant) => ({
// "name" can only contain letters, numbers, and dashes
name: toId(participant.name),
pluginName,
type: 'USER', // The options are USER, BOT, ORGANIZATION, PROJECT
alias: {
description: `participant: ${participant.name}`,
address: addr(participant),
}
}))
)

Insert cell
identityProposals = createIdentityProposals({ pluginName, participants: Object.values(participants) })
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
// should not error
graphOutput = sc.api.graph.graph(graphInput)
Insert cell
Insert cell
Insert cell
// should not error
credrankOutput = sc.api.credrank.credrank(credrankInput)
Insert cell
Insert cell
credrankOutput.credGrainView
.participants()
.map(p => `${p.identity.name.padStart(15, ' ')} ${p.cred}`)
.join('\n')
Insert cell
Insert cell
Insert cell
serializedWeightedGraph = JSON.stringify(
sc.core.weightedGraph.toJSON(weightedGraph), null, 2 // Notice, this is a little different than the other two.
)
Insert cell
serializedDeclaration = JSON.stringify(declaration, null, 2)
Insert cell
serializedIdentityProposals = JSON.stringify(identityProposals, null, 2)
Insert cell
csv = sc.api.analysis.analysis({
credGraph: credrankOutput.credGraph,
ledger: credrankOutput.ledger,
featureFlags: { neo4j: true },
})
Insert cell
nodeList = {
const nodeList = []
for(let line of csv.neo4j.nodes) {
nodeList.push(line)
}
return nodeList.join('\n')
}
Insert cell
Insert cell
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more