decomp.graph

Module for converting between NetworkX and RDFLib graphs.

class NXConverter[source]

Bases: object

A converter between RDFLib graphs and NetworkX digraphs.

Parameters:

graph – the graph to convert

__init__(rdfgraph)[source]
classmethod rdf_to_networkx(rdfgraph)[source]

Convert an RDFLib graph to a NetworkX digraph.

Parameters:

rdfgraph (Graph) – the RDFLib graph to convert

Return type:

DiGraph

class RDFConverter[source]

Bases: object

A converter between NetworkX digraphs and RDFLib graphs.

Parameters:

nxgraph (DiGraph) – the graph to convert

PROPERTIES: ClassVar[dict[str, URIRef]] = {'confidence': rdflib.term.URIRef('confidence'), 'domain': rdflib.term.URIRef('domain'), 'subspace': rdflib.term.URIRef('subspace'), 'type': rdflib.term.URIRef('type')}
SUBSPACES: ClassVar[dict[str, URIRef]] = {}
VALUES: ClassVar[dict[str, URIRef]] = {}
__init__(nxgraph)[source]
classmethod networkx_to_rdf(nxgraph)[source]

Convert a NetworkX digraph to an RDFLib graph.

Parameters:

nxgraph (DiGraph) – the NetworkX graph to convert

Return type:

Graph