webgraph_swh
Python bindings for Software Heritage graph access.
A bidirectional Software Heritage graph with node properties.
Loads the graph and all available properties (maps, persons, strings,
timestamps) from the given base path. Node IDs are integers in
[0 . . num_nodes).
Return the number of successors of the given node.
Raises IndexError if node is out of range.
Return the number of predecessors of the given node.
Raises IndexError if node is out of range.
Return an iterator over the predecessors of the given node.
Raises IndexError if node is out of range.
Return an iterator over the successors of the given node.
Raises IndexError if node is out of range.
Return the committer person ID, or None if not available.
Raises IndexError if node is out of range.
Return the node type as a PyNodeType enum value.
Raises IndexError if node is out of range.
Return the committer timestamp (seconds since epoch), or None.
Raises IndexError if node is out of range.
Return the SWHID of the given node as a string.
Raises IndexError if node is out of range.
Return the URL of the Software Heritage archive page for the given
node (e.g., https://archive.softwareheritage.org/swh:1:rev:...).
Raises IndexError if node is out of range.
Return the commit/tag message, or None if not available.
Raises IndexError if node is out of range.
Return the tag name, or None if not a release or not available.
Raises IndexError if node is out of range.
Return a numpy uint32 array of outdegrees for all nodes, computed
in parallel. The array is indexed by node ID.
Return a numpy uint32 array of indegrees for all nodes, computed
in parallel. The array is indexed by node ID.
Return a (k, 2) array: column 0 = node IDs, column 1 = outdegrees.
Return a (k, 2) array: column 0 = node IDs, column 1 = indegrees.
Return a FilteredSwhGraph restricted to the given node types.
The constraint string is a comma-separated list of type
abbreviations (cnt, dir, ori, rel, rev,
snp) or * for all types.
Example::
revrel = g.subgraph("rev,rel")
Load the forward BvGraph from the same base path.
Returns a webgraph.BvGraph instance.
Load the backward (transposed) BvGraph from the same base path.
Returns a webgraph.BvGraph instance.
A view of an SwhGraph restricted to specific node types.
Created by SwhGraph.subgraph(). Node IDs are not renumbered.
Return the number of successors matching the node-type constraint.
Raises IndexError if node is out of range, or ValueError
if the node does not match the constraint.
Return the number of predecessors matching the node-type constraint.
Raises IndexError if node is out of range, or ValueError
if the node does not match the constraint.
Return an iterator over successors matching the node-type constraint.
Raises IndexError if node is out of range, or ValueError
if the node does not match the constraint.
Return an iterator over predecessors matching the node-type constraint.
Raises IndexError if node is out of range, or ValueError
if the node does not match the constraint.
Return a numpy array of filtered outdegrees for all nodes, computed in parallel.
Nodes not matching the constraint have degree 0, so that
array[node_id] is the filtered outdegree for matching nodes.
Return a numpy array of filtered indegrees for all nodes, computed in parallel.
Nodes not matching the constraint have degree 0, so that
array[node_id] is the filtered indegree for matching nodes.
Return the committer person ID, or None if not available.
Raises IndexError if node is out of range, or ValueError
if the node does not match the constraint.
Return the node type as a PyNodeType enum value.
Raises IndexError if node is out of range, or ValueError
if the node does not match the constraint.
Return the committer timestamp (seconds since epoch), or None.
Raises IndexError if node is out of range, or ValueError
if the node does not match the constraint.
Return the SWHID of the given node as a string.
Raises IndexError if node is out of range, or ValueError
if the node does not match the constraint.
Return the URL of the Software Heritage archive page for the given
node (e.g., https://archive.softwareheritage.org/swh:1:rev:...).
Raises IndexError if node is out of range, or ValueError
if the node does not match the constraint.
Return the commit/tag message, or None if not available.
Raises IndexError if node is out of range, or ValueError
if the node does not match the constraint.
Return the tag name, or None if not a release or not available.
Raises IndexError if node is out of range, or ValueError
if the node does not match the constraint.
Return a (k, 2) array: column 0 = node IDs, column 1 = outdegrees.
Sparse map from contributor IDs to display names.
SWH node types.
Integer values match the encoding used in the SWH graph: Content=0, Directory=1, Origin=2, Release=3, Revision=4, Snapshot=5.
Iterator over node IDs (successors or predecessors).